public class Parent {
protected int i;
public Parent() {
i = 1;
}
}
public class Child extends Parent {
private int i;
public Child() {
this.i = ((Child)new Parent()).getI();
this.i = this.i++ + ++super.i;
}
public int getI() {
return i;
}
}
What will be the output of the following code?
public class Test {
public static void main(String[] args) {
Child c = new Child();
System.out.println(c.getI());
}
}
Login in to like
Login in to comment