Primitive Values

A primitive type is predefined by the Expression Language and named by its reserved keyword:


						PrimitiveType:
									NumericType
									Boolean
						NumericType:
									IntegralType
									FloatingPointType
						IntegralType: one of
									byte short int long BigInteger char
						FloatingPointType: one of
									float double BigDecimal

Primitive values do not share state with other primitive values. A variable whose type is a primitive type always holds a primitive value of that same type or null. The value of a variable of primitive type can be changed only by assignment operations on that variable:

  • The numeric types are the integral types and the floating-point types.

  • The integral types are byte, short, int, long, and BigInteger, whose values are 8-bit, 16-bit, 32-bit, 64-bit and unlimited signed two's-complement integers, respectively, and char, whose values are 16-bit unsigned integers representing Unicode characters.

  • The floating-point types are float, whose values include the 32-bit IEEE 754 floating-point numbers, and double, whose values include the 64-bit IEEE 754 floating-point numbers, and BigDecimal, whose value include an unlimited size floating-point numbers.

  • The Boolean type has exactly two values: true and false.

As opposed to the Java programming language where primitive types are not considered reference types, the Expression Language treats them the same. That means the reference type Integer and the primitive data type int are one and the same. All primitive data types share the same features as a reference type. So although an attempt was made in this chapter to separate them, primitive data types should be considered as reference data types as well.