Java Reference
In-Depth Information
In summary, a local variable declaration cannot be used as the repeated statement in a
for
,
while
,
or
do
loop but can appear only as a statement directly within a block. Also,
when using a variable
to count instance creations, use a
long
rather than an
int
, to prevent overflow.
Finally, if you
are going to create instances in multiple threads, either synchronize access to the instance counter
or use an
AtomicLong
.
< Day Day Up >
Search WWH ::
Custom Search