Java Reference
In-Depth Information
V is [un]assigned before an expression statement S other than the first in the
initialization part iff V is [un]assigned after the expression statement immedi-
ately preceding S .
16.2.12.2. Incrementation Part of for Statement
• If the incrementation part of the for statement is empty, then V is [un]assigned after
the incrementation part iff V is [un]assigned before the incrementation part.
• Otherwise, three rules apply:
V is [un]assigned after the incrementation part iff V is [un]assigned after the
last expression statement in the incrementation part.
V is [un]assigned before the first expression statement in the incrementation
part iff V is [un]assigned before the incrementation part.
V is [un]assigned before an expression statement S other than the first in the in-
crementation part iff V is [un]assigned after the expression statement immedi-
ately preceding S .
16.2.13. break , continue , return , and throw Statements
• By convention, we say that V is [un]assigned after any break , continue , return , or throw
statement (§ 14.15 , § 14.16 , § 14.17 , § 14.18 ) .
The notion that a variable is “[un]assigned after” a statement or expression
really means “is [un]assigned after the statement or expression completes nor-
mally”. Because a break , continue , return , or throw statement never completes nor-
mally, it vacuously satisfies this notion.
• In a return statement with an expression e or a throw statement with an expression e ,
V is [un]assigned before e iff V is [un]assigned before the return or throw statement.
16.2.14. synchronized Statements
V is [un]assigned after synchronized ( e ) S 14.19 ) iff V is [un]assigned after S .
V is [un]assigned before e iff V is [un]assigned before the statement synchronized ( e )
S .
V is [un]assigned before S iff V is [un]assigned after e .
16.2.15. try Statements
These rules apply to every try statement (§ 14.20 ), whether or not it has a finally block:
V is [un]assigned before the try block iff V is [un]assigned before the try statement.
Search WWH ::




Custom Search