??????????д
????1????д?????????й????С?????????????????????????л?????д?????????????????????????????????final????д?????????????????????????????е??????
????class Animal {
????public void eat(){
????System.out.println ("Animal is eating.");
????}
????}
????class Horse extends Animal{
????public void eat(){
????System.out.println ("Horse is eating.");
????}
????}
????2???????????????????????????????????д???????÷????????????????????????????????????????????????д???????
????3????д?????塣

??????д????????????????????????????????????????????????????ж???????????????е??????
public class Test {
public static void main (String[] args) {
Animal h = new Horse();
h.eat();
}
}
class Animal {
public void eat(){
System.out.println ("Animal is eating.");
}
}
class Horse extends Animal{
public void eat(){
System.out.println ("Horse is eating.");
}
public void buck(){
}
}
????????????????????????????????????????????????е????????????????????е??????????????h.buck(); ???????????????????????????????????????????????????????????
????4????д?????????
???????????????????д??????????????????????????????????????
????A????д??????????д????????????д?????????и???????????
?????????????????????縸??????????????????????д??????public??????????
???????磺Object???и?toString()???????????д??????????????????????????public???η???????????????????κν???????????????????????м??κη??????η?????????а???????????????????public?????????????????????????
????B????д??????????????б????????д???????????
??????д?и?????????????????????????????????????????????????????????????????????????????????????????д??
????C????д????????????????????????д??????????????????
??????????A??void eat(){} ??????B??int eat(){} ????????????????????????????????????????д??
??????????A??int eat(){}   ??????B??long eat(){} ???????????????????????????????????????д??
????D????д??????????д????????????μ???????????д?????????????????????????????????????????????????????????
import java.io.*;
public class Test {
public static void main (String[] args) {
Animal h = new Horse();
try {
h.eat();
}
catch (Exception e) {
}
}
}
class Animal {
public void eat() throws Exception{
System.out.println ("Animal is eating.");
throw new Exception();
}
}
class Horse extends Animal{
public void eat() throws IOException{
System.out.println ("Horse is eating.");
throw new IOException();
}
}
????????????У??????????????Exception???????????IOException??Exception???????????????д???????????????????????????????????????????????IOException?????????????????Exception??????????????????
??????????????????????????????????????RuntimeException???????????????????С?