Java Reference
In-Depth Information
A break without a label causes termination of its immediately enclosing loop or
switch statement. A break with a label causes control to transfer to the end of the
labeled block.
7 . In the following fragment, after the break statement executes, what is displayed?
After break executes, “after while” is displayed.
8 . What does the following fragment print?
Here is the answer:
9 . The iteration expression in a for loop need not always alter the loop control variable
by a fixed amount. Instead, the loop control variable can change in any arbitrary way.
Using this concept, write a program that uses a for loop to generate and display the
progression 1, 2, 4, 8, 16, 32, and so on.
Search WWH ::




Custom Search