unreachable_side_effect.mj 452 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
class UnreachableSideEffect {
    public int a;

    public UnreachableSideEffect init(int a) {
        this.a = a;
        return this;
    }

    public void test() {
        this.a = 42;
        return;
        this.a = 23;
    }

    public static void main(String[] args) {
        UnreachableSideEffect use = new UnreachableSideEffect().init(10);

        System.out.println(use.a);
        use.test();
        System.out.println(use.a);
    }
}