Java Reference
In-Depth Information
Object
Naturally, no literals exist for Object, but there are two operators:
obj1
==
obj2 // equals
obj1
!=
obj2 // not equals
Vo i d
The only possible instance of Void is the
null
reference. Therefore, just one lit-
eral exists:
null
.
Type Literals
The literal for types is simply the name of the type—for example:
String // the type string
my::special::Type // evaluates to the type 'my::special::Type'
The literal for static properties (also known as enumeration literals) is simi-
lar to type literals:
my::Color::RED
Two different literal syntaxes are used for Strings (with the same semantics):
'a String literal'
"a String literal"
For Strings, the expression language supports the plus operator that is over-
loaded with concatenation:
'The element ' + element.name + ' is ' + element.state
The Boolean literals are
true
and
false
.
These are the Boolean operators:
true && false
// AND
true || false
// OR
! true
// NOT
Search WWH ::
Custom Search