?????????????????
??????????????????????????й???????
????????class??????????????й??????????????е???????????????????
???????????г??????????????????????
??????????У??????????????
????????????abstract?????????Щ???????棿
????final???????????????????????????final?????????????????????
????private?????????????????????????????????????????
????static?????????????????????ó????????????ó???????????塣
????????interface??
?????????????????????????????????????????????????????????????????????????????????壬????б??????????????
?????????interface?????{}
????????????”????“??????????????????????”?????“??
????????implements??
?????????class????implements?????{}
???????
??????????????????
?????????????????????????????????????е????з?????
?????????????
????????е??????η????????
?????????????public static final??????????????????????????????η?????????????????????????????????????д??
?????????????public abstract?????????????????????????????η???????????
??????????????????????η???
?????????????????
?????????????????й??????????????????????????????????????????????????????????????????????????????????м??ɡ???????У????????С???(class)??
?????????????????????????????е?????????????????????????????????????????????????????????????????????????????????????(class)extends(class)implements(interface1??interface2…)??
?????????????????й??????????????????????????????μ????????????????????????С???(interface)extends(interface1??interface2…)??
??????????????????
???????????
?????????????б?????????г???
???????????г???
???????????
??????????????з????????????????г???????
???????????г???????
??????????
????-???????й?????
????-?????й?????
???????????????????
????????????????????extends
??????????????????implements
??????????????
??????????????????
?????????????????????
????????????????????(???????黯??????????ù??????????????????飬???????????Ч??)
????????????????????
???????????????????????????
????????????????????????й???????
???????й????????????????????????????
????//??????????????????????·??????
????/*
?????????????????
??????????????????
???????????????????????????????????????
??????????????????????????????Щ??????Щ?????????Щ????
????*/
????interface SpeakEnglish{
????public abstract void speak();
????}
????interface GoAboard{
????public abstract void aboard();
????}
????abstract class Person{
????private String name;
????private int age;
????public Person(){}
????public Person(String name??int age){
????this.name=name;
????this.age=age;
????}
????public void setName(String name){
????this.name=name;
????}
????public String getName(){
????return name;
????}
????public void setAge(int age){
????this.age=age;
????}
????public int getAge(){
????return age;
????}
????//???
????public abstract void eat();
????//???
????public void sleep(){
????System.out.println("Zzz...");
????}
????}
????//????
????abstract class Player extends Person{
????public abstract void study();
????}
????//????
????abstract class Coach extends Person{
????public abstract void teach();
????}
????//????????
????class BasketballPlayer extends Player implements SpeakEnglish??GoAboard{
????public void eat(){
????System.out.println(getAge()+"???"+getName()+"?????");
????}
????public void study(){
????System.out.println(getAge()+"???"+getName()+"?????");
????}
????public void speak(){
????System.out.println(getAge()+"???"+getName()+"Say Hello World");
????}
????public void aboard(){
????System.out.println(getAge()+"???"+getName()+"Go Aboard");
????}
????}
????//???????
????class PingPangPlayer extends Player{
????public void eat(){
????System.out.println(getAge()+"???"+getName()+"?????");
????}
????public void study(){
????System.out.println(getAge()+"???"+getName()+"?????");
????}
????}
????//???????
????class BasketballCoach extends Coach implements SpeakEnglish{
????public void eat(){
????System.out.println(getAge()+"???"+getName()+"?м??");
????}
????public void teach(){
????System.out.println(getAge()+"???"+getName()+"?????");
????}
????public void speak(){
????System.out.println(getAge()+"???"+getName()+"Say Hello Java");
????}
????public void aboard(){
????System.out.println(getAge()+"???"+getName()+"Go Aboard");
????}
????}
????//????????
????class PingPangCoach extends Coach{
????public void eat(){
????System.out.println(getAge()+"???"+getName()+"??????");
????}
????public void teach(){
????System.out.println(getAge()+"???"+getName()+"?????");
????}
????}
????class PlayerAndCoach{
????public static void main(String[]args){
????//????????
????BasketballPlayer bp=new BasketballPlayer();
????bp.setName("??????");
????bp.setAge(33);
????bp.eat();
????bp.sleep();
????bp.study();
????bp.speak();
????bp.aboard();
????System.out.println("***********************");
????//???????
????BasketballCoach bc=new BasketballCoach();
????bc.setName("???????");
????bc.setAge(65);
????bc.eat();
????bc.sleep();
????bc.teach();
????bc.speak();
????bc.aboard();
????System.out.println("***********************");
????//???
????Person p=new BasketballPlayer();
????p.setName("Kobe Bryant");
????p.setAge(33);
????p.eat();
????p.sleep();
????//p.study();
????//p.speak();
????BasketballPlayer bp2=(BasketballPlayer)p;
????bp2.study();
????bp2.speak();
????bp2.aboard();
????System.out.println("***********************");
????}
????}
?????????
?????????????????????????棬?????????????????????????????δ?????Java????е???????
???????????
?????????????????????????????????г????
?????????????????????????????????????????
?????????????????
?????????
??????????????????????????????????????????????????.class??????????????????????????$?????
??????????????????????????????????????????????????????????????????????????????????????private???
????????????
?????????????г??????????????????????????????????????????????????
??????????????????????з????????
????????????????????????.?????????????=???????.????????
????????????????????????????????????????????????ж???????????????????????????.this??
?????????????????????η???final??abstract??public??private??protected??static.
????????????
?????????????????????????????η?static???????????з?????
???????????з?????????????????????
???????????з???????????з????????*??????.?????????????=??????.???????*????????????????????
???????????з???????????е????????????????????????????з?????????????????????.???????.?????
????????????
???????????????????????е???
????????????????????????????????????????????????????????????????
?????????????????????????????????????final?????????
????????????????????????η???final??abstract??
????????????е??????????????????????????
?????????????
??????????????????????д?????????????????????????????????????????
???????
?????????????л?????????????????
?????????
????new??????????????(){??д????};
?????????????????????????????????????y???е???????????????????????????????????????????
??????????η????ε?????(??????????)

??????????????????£?
??????????е?????public???Ρ???????????java????У??д?????
??????????е?????????private???Ρ?
??????????е?????????public???Ρ?
????????????????????public abstract+…
??????????е????????public???Ρ?
??????????????????????????????private????
??????????????η?
 


???????????private
??????????public
???????????public