强类型枚举
Definition:
定义:
Java is a strongly typed programming language because every variable must be declared with a data type. A variable cannot start off life without knowing the range of values it can hold, and once it is declared, the data type of the variable cannot change.
Java是一种强类型编程语言,因为每个变量都必须使用数据类型声明。 变量在不知道其可容纳的值范围的情况下就无法重新开始,并且一旦声明,变量的数据类型就无法更改。
Examples:
例子:
The following declaration is allowed because the variable has "hasDataType" is declared to be a boolean data type:
允许进行以下声明,因为具有“ hasDataType”的变量被声明为布尔数据类型:
boolean hasDataType;
For the rest of its life, hasDataType can only ever have a value of true or false.
在余下的时间内,hasDataType只能具有true或false的值。
强类型枚举