summaryrefslogtreecommitdiff
path: root/output/ex51.java
blob: 96a5d5a5e7a0df63368657dff97dbe8343255f1c (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
class ex51{
    public static void main(String[] a){
        System.out.println(new Test().start());
    }
}

class Test {

    Test test;
    int[] i;

    public int setval(int pos, int val) { i[pos] = val; return 0; }
    public int getval(int pos) { int val; val = i[pos]; return val; }

    public int start(){
        Test foo;
        int val;
        foo = this;
        i = new int[10];

        test = (new Test()).next();
        val = foo.setval(2, 42);
        test = this;
        val = test.getval(2);
        return val;
    }

    public Test next() {
        return test;
    }
}