?????????????????????JVM???????????
??????? – ???????????????????????
?????????????? – ????????????????????????ж???????????
????Q.????????????“?????????”??????????????????????????????????????????
????A.????????????????????????????ù??????Щ??????????ü?е???????????????????????ж??????????????????ü?е??????????????????????“????”???????????
??????????????????????С???????????????????????????????????й???????????ü?У????“extends”?????????????????????????????е??????????????????????????????????????????
????????????????????С??????????????м?й?????????????????????????????????????????????????????????????????????????????????????????????
????????????????Gang of Four??????????????????????????????е?????????????????????????????????——“???”??“?????????”?????“???????????????????”?????????????????????????????????????????????????????????????????????????????????????????????????
????Q.???????????????????????к????????У???????Java?????????
????A.“???”?????????????????????????????????????????Java?????????????????У????????“extends”????????????????????????????????
public class Parent {
public String saySomething( ) {
return “Parent is called”;
}
}
public class Child extends Parent {
@Override
public String saySomething( ) {
return super.saySomething( ) +  “?? Child is called”;
}
}
????“Child”???saySomething()????????????“Parent is called??Child is Called”??????????????ü????????“Parenet is called”???????“super”??????????“Parent”???????????????б???????????????/????????Java??????????????????У??????????????????????“????”????“???”??????????????????????ζ??????????????????????????е???????Java??????????????????£?
public class Parent {
public String saySomething( ) {
return “Parent is called”;
}
}
public class Child  {
public String saySomething( ) {
return new Parent( ).saySomething( ) +  “?? Child is called”;
}
}
???????????????????á???????????????????????
public class Child  {
private Parent parent = null;
public Child( ){
this.parent = new Parent( );
}
public String saySomething( ) {
return this.parent.saySomething( ) +  “?? Child is called”;
}
}