Below is the program, i want to understand
class First{
First(){
System.out.println("In first constructor");
func();
}
public void func(){
System.out.println("In First func");
}
}
public class TestSubClass extends First{
TestSubClass(){
System.out.println("In Test SubClass constructor");
func();
}
public void func(){
System.out.println("In TestSubClass func");
}
public static void main(String args[]){
TestSubClass tsc = new TestSubClass();
}
}
The out put is
In first constructor
In TestSubClass func
In Test SubClass constructor
In TestSubClass func
Why is the second line of output "In TestSubClass func", but not "In First func".