KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > Unreach


1 /* Unreach Copyright (C) 1999 Dave Mugridge.
2  *
3  * $Id: Unreach.java,v 1.3 1999/08/19 15:16:59 jochen Exp $
4  */

5
6
7 /* A test class submitted by dave@onekiwi.demon.co.uk */
8 class Unreach
9 {
10     static int j = 0;
11     final double[] d = {0.5, 0.4, 0.3}; // won't decompile
12

13     public static final void m(int i) throws Exception JavaDoc {
14     switch (i) {
15     case 1:
16         j += 2;
17             for (;;) {
18                 j += 3;
19                 switch (j) {
20                 case 2:
21                     break;
22                 default:
23                     j += 4;
24                     return;
25                 }
26             }
27             // An unreachable break is inserted here
28
default:
29         j += 5; // decompiles as j = j + 1; -- not quite optimal
30
}
31     }
32 }
33
Popular Tags