hi, all, the following code really bothers me.
class Super{
String name;
//1
Super(String s){//2
name =s ;
} }
class Sub extends Super{
String name;
Sub(String s){
name=s;
}
public static void main(String args[]){
Super sup = new Super("First");
Sub sub = new Sub("Second");
System.out.println(sub.name + " " + sup.name);
}
}
i thought it should work fine. actually i got compilation error. if i add a contructor without argument " Super(){}" at //1, it will be working fine. i don't know why as i think there is already a contructor over there at //2; could someone please kindly explain. thanks.
arthur