TYPES, VALUES, AND VARIABLES
Reference Types and Values
4.3
Boolean expressions determine the control flow in several kinds of statements:
The
if
statement ( 14.8)
The
while
statement ( 14.10)
The
do
statement ( 14.11)
The
for
statement ( 14.12)
A
boolean
expression also determines which subexpression is evaluated in the
conditional
? :
operator ( 15.24).
Only
boolean
expressions can be used in control flow statements and as the
first operand of the conditional operator
? :
. An integer
x
can be converted to a
boolean
, following the C language convention that any nonzero value is
true
, by
the expression
x!=0
. An object reference
obj
can be converted to a
boolean
,
following the C language convention that any reference other than
null
is
true
,
by the expression
obj!=null
.
A cast of a
boolean
value to type
boolean
is allowed ( 5.1.1); no other casts
on type
boolean
are allowed. A
boolean
can be converted to a string by string
conversion ( 5.4).
4.3 Reference Types and Values
There are three kinds of
reference types
: class types ( 8), interface types ( 9), and
array types ( 10).
ReferenceType:
ClassOrInterfaceType
ArrayType
ClassOrInterfaceType:
ClassType
InterfaceType
ClassType:
TypeName
InterfaceType:
TypeName
ArrayType:
Type
[ ]
Names are described in 6; type names in 6.5 and, specifically, 6.5.4.
37
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved