Last change
on this file was 2, checked in by bird, 22 years ago |
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
File size:
653 bytes
|
Line | |
---|
1 | // PR 109
|
---|
2 |
|
---|
3 | // Running the test code produces the output "0" instead of the
|
---|
4 | // expected "01234".
|
---|
5 |
|
---|
6 | // The break statement exits both for-loops (not just the innermost
|
---|
7 | // one) if the (single statement) body of the outer for-loop is not
|
---|
8 | // enclosed in braces. Affects more deeply nested loops in the same
|
---|
9 | // way.
|
---|
10 |
|
---|
11 | public class pr109
|
---|
12 | {
|
---|
13 | public static void main (String argv[])
|
---|
14 | {
|
---|
15 | int i, j;
|
---|
16 |
|
---|
17 | for (i = 0; i < 5; i++)
|
---|
18 | for (j = 0; j < 2; j++)
|
---|
19 | {
|
---|
20 | if (j == 1)
|
---|
21 | break;
|
---|
22 | System.out.print (i);
|
---|
23 | }
|
---|
24 |
|
---|
25 | // We print a newline here because otherwise the DejaGNU log
|
---|
26 | // file is screwed up.
|
---|
27 | System.out.println ();
|
---|
28 | }
|
---|
29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.