Commit 802d215b authored by Carlos Galindo's avatar Carlos Galindo
Browse files

New tests with return statements in the constructor.

parent 7a0844e5
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
class Test {
    int a;

    Test(int a, boolean b, int c) {
        if (b) {
            this.a = a * c / (a + c);
            return;
        }
        this.a = 10;
    }

    public static void main(String[] args) {
        Test t = new Test(15, true, 10);
        int a = t.a;
        System.out.println(a);
    }
}
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
15
 No newline at end of file
+17 −0
Original line number Diff line number Diff line
class Test {
    int a;

    Test(int a, boolean b, int c) {
        if (b) {
            this.a = a * c / (a + c);
            return;
        }
        this.a = 10;
    }

    public static void main(String[] args) {
        Test t = new Test(15, true, 10);
        int a = t.a;
        System.out.println(a);
    }
}
 No newline at end of file