Hello I found a question like this. The final answer printed by the main method is 3. But what I feel is the answer should be 13. When the new Bar() object is created, its constructor is called. the super() first line, would call back the Super method's constructor and assign a as 3. When call returns back to Bar() constructor "a" will be assigned to 8. Then after invoking addFive() this.a will be 13. So finally at the print statement by using the object Bar() referenced by n, calls a. Isn't it should be 13. How did the super calss "a" value print? please someone help me to sort it out.
public class _416 {
public int a;
public _416(){
a=3;
}
public void addFive(){
a+=5;
}
}
class Bar extends _416{
public int a;
public Bar(){
a=8;
}
public void addFive(){
this.a+=5;
}
public static void main(String[] args) {
_416 n=new Bar();
n.addFive();
System.out.println("Value="+n.a);
}
}