Java Reference
In-Depth Information
When the increment operator precedes its operand, Java will perform the increment
prior to obtaining the operand's value for use by the rest of the expression. If the op-
erator follows its operand, then Java will obtain the operand's value before incre-
menting.
7 . Show how a short-circuit AND can be used to prevent a divide-by-zero error.
8 . In an expression, what type are byte and short promoted to?
In an expression, byte and short are promoted to int .
9 . In general, when is a cast needed?
A cast is needed when converting between incompatible types or when a narrowing
conversion is occurring.
10 . Write a program that finds all of the prime numbers between 2 and 100.
11 . Does the use of redundant parentheses affect program performance?
Search WWH ::




Custom Search