Java Reference
In-Depth Information
16.1.5. Conditional Operator
? :
Suppose that
b
and
c
are boolean-valued expressions.
when true and
V
is [un]assigned after
c
when true.
•
V
is [un]assigned after
a
?
b
:
c
when false iff
V
is [un]assigned after
b
when false
and
V
is [un]assigned after
c
when false.
•
V
is [un]assigned before
a
iff
V
is [un]assigned before
a
?
b
:
c
.
•
V
is [un]assigned before
b
iff
V
is [un]assigned after
a
when true.
•
V
is [un]assigned before
c
iff
V
is [un]assigned after
a
when false.
•
V
is [un]assigned after
a
?
b
:
c
iff
V
is [un]assigned after
a
?
b
:
c
when true and
V
is
[un]assigned after
a
?
b
:
c
when false.
16.1.6. Conditional Operator
? :
Suppose that
b
and
c
are expressions that are not boolean-valued.
[un]assigned after
c
.
•
V
is [un]assigned before
a
iff
V
is [un]assigned before
a
?
b
:
c
.
•
V
is [un]assigned before
b
iff
V
is [un]assigned after
a
when true.
•
V
is [un]assigned before
c
iff
V
is [un]assigned after
a
when false.
16.1.7. Other Expressions of Type
boolean
Suppose that
e
is an expression of type
boolean
and is not a boolean constant expression,
logical complement expression
!
a
, conditional-and expression
a
&&
b
, conditional-or ex-
pression
a
||
b
, or conditional expression
a
?
b
:
c
.
•
V
is [un]assigned after
e
when true iff
V
is [un]assigned after
e
.
•
V
is [un]assigned after
e
when false iff
V
is [un]assigned after
e
.
16.1.8. Assignment Expressions
Consider an assignment expression
a
=
b
,
a
+=
b
,
a
-=
b
,
a
*=
b
,
a
/=
b
,
a
%=
b
,
a
<<=
b
,
a
•
V
is definitely assigned after the assignment expression iff either:
♦
a
is
V
, or