field_init.mj 546 Bytes
Newer Older
uwdkn's avatar
uwdkn committed
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 A {
    public int a;

    public void print_as() {
        System.out.println(a);
        System.out.println(this.a);
    }

    public static void main(String[] args) {
        A a = new A();
        a.print_as();
        B b = new B();

        if (b.b) {
            System.out.println(1);
        } else {
            System.out.println(0);
        }

        if (b.c == null) {
            System.out.println(0);
        } else {
            System.out.println(1);
        }
    }
}

class B {
    public boolean b;
    public A c;
}