????????????????濴???????????????????磩??

????Java????

view plaincopy to clipboardprint?
public class Father { 
????public void method() { 
?????? System.out.println("?????????????????" + this.getClass()); 
????} 

???? 
public class Son extends Father { 
????public static void main(String[] args) { 
?????? Father sample = new Son();//??????? 
?????? sample.method(); 
????} 
}

???????????????????????????е?????е?????????????????????????????????method?????????????????????????????????????

????Java????

public class Son extends Father { 
????public void method() { 
?????? System.out.println("?????????????????" + this.getClass()); 
????} 
???? 
????public static void main(String[] args) { 
?????? Father sample = new Son();//??????? 
?????? sample.method(); 
????} 
}

??????????????д??????method??????????????????????????????????method???????У?????????????method????????????????????

??????????????????????java???????????????????java???е??????????????????????????????????????????????????????????????????£???????????????????????????????????????????

???????????£?

????Java????

public class Father { 
 
????protected String name="????????"; 
???? 
????public void method() { 
?????? System.out.println("?????????????????" + this.getClass()); 
????} 

???? 
public class Son extends Father { 
????protected String name="????????"; 
???? 
????public void method() { 
?????? System.out.println("?????????????????" + this.getClass()); 
????} 
???? 
????public static void main(String[] args) { 
?????? Father sample = new Son();//??????? 
?????? System.out.println("?????????"+sample.name); 
????} 
}

???????????????????????????