???????????????java?????????????
???????????? ???????[ 2015/4/8 13:52:47 ] ??????????????? java
???????н?????£?
????This is Father’s method
????This is Father’s method
????This is Father’s method
????????????????????????????????method(Father father)????????????????????е?????????????????????????????????method(Father father)???????????????java???????????????
????instanceof???????????
?????????????????????????????????????????????????????????????????????????????????????java????????????????????????????????java?????????????????????????????????????ж?????????????instanceof??????????????????ж?????????method(Father father)??????????????????ж??????????????????????method(Father father)???????£?
????public void method(Father father){
????if(father instanceof Son1){
????method((Son1)father);
????}else if(father instanceof Son2){
????method((Son2)father);
????}else if(father instanceof Father){
????System.out.println("This is Father's method");
????}
????}
??????????????????ж????????????????????ж?????Father???????????????????????ж??Father?????????????ж???????????????????????????????????????????????????????????н?????£?
????This is Father’s method
????This is Son1′s method
????This is Son2′s method
??????????????????????????????????α????????????????????????????ж??????????Father??100??????????????????????????????????????????????????????????У?????????????????????????????
??????????????????
????????????????????????23?????????9???????????????????????????
??????A?е????method1??method2?????????method2??????ɡ????????????java?????????????????????????B????B?????showA(A a) ????????????У???????A??method1???????????A??method2?????е?????B??showA??????????????????????showA????????????????this?????????????????????????????????????????????????Ч??????????????????????????????????????????????????????£?
class Father {
public void accept(Execute exe){
exe.method(this);
}
}
class Son1 extends Father{
public void accept(Execute exe){
exe.method(this);
}
}
class Son2 extends Father{
public void accept(Execute exe){
exe.method(this);
}
}
class Execute {
public void method(Father father){
System.out.println("This is Father's method");
}
public void method(Son1 son){
System.out.println("This is Son1's method");
}
public void method(Son2 son){
System.out.println("This is Son2's method");
}
}
public class Test {
public static void main(String[] args){
Father father = new Father();
Father s1 = new Son1();
Father s2 = new Son2();
Execute exe = new Execute();
father.accept(exe);
s1.accept(exe);
s2.accept(exe);
}
}
?????????????????????????Father??Son1??Son2?з???????????????????????????????????Execute??method????????????????Father??accept?????????н?????£?
????This is Father’s method
????This is Son1′s method
????This is Son2′s method
???????н?????????????????????????????????????????????????????????????????????????и????????????????????????????????????????????instanceof????????Ч????????????instanceof????????????????????????????????????instanceof????????????????????????instanceof?????????????????????????????????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Java???????????Щ???????????????Java????????????????Java?б???Map????????Java Web???????????????Java??????????????д?????Java????????7???????????????????????(java .net ?????)???Java??????????Python??????Java webdriver??λ????????′????е?????Java??д??????????????????Java???????????????JavaScript????????????Java?????????????????? Java???????10??????????????Java?м????????????????java???????ü???????????м???????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????