aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/test4/LocalVars.java
blob: 17ab6cd18a0914401a7042f17cd7124c08ebbb3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package test4;

public class LocalVars {
    public int run() {
        int i = 0;
        int p = i;
        int q = p;
        int r = q;
        for (int k = 1; k < 3; ++k)
            p += k;

        for (int k = 3; k > 0; --k)
            try {
                foo(k);
                p++;
            }
            finally {
                p++;
            }

        switch (p) {
        case 1:
            p = 100;
            break;
        default :
            ++p;
        }
        return p + r;
    }

    public int run2() {
        int i = 0;
        int p = i;
        int q = p;
        int r = q;
        for (int k = 1; k < 3; ++k)
            p += k;

        for (int k = 3; k > 0; --k)
            try {
                foo(k);
                p++;
            }
            finally {
                p++;
            }

        switch (p) {
        case 1:
            p = 100;
            break;
        default :
            ++p;
        }
 
        return p + r;
    }

    public int foo(int i) { return i; }
}