OSDN Git Service

PR java/16789:
[pf3gnuchains/gcc-fork.git] / libjava / testsuite / libjava.lang / pr109.java
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 }