//新手笔记提醒
public abstract class Animal {
public abstract void call();
}
----------------------------
public class Dog extends Animal{
public abstract void call();
}
----------------------------
public class Dog extends Animal{
@Override
public void call() {
// TODO Auto-generated method stub
System.out.println("wangwang");
}
public void ear(){
System.out.println("chigutou");
}
public void call() {
// TODO Auto-generated method stub
System.out.println("wangwang");
}
public void ear(){
System.out.println("chigutou");
}
}
public class Test {
public static void main(String[]args){
Animal an=new Dog(); //由Animal提供方法,由Dog实现
an.call();
an.eat(); //Animal没有eat()方法,所以会报错
}
}
public class Test {
public static void main(String[]args){
Animal an=new Dog(); //由Animal提供方法,由Dog实现
an.call();
an.eat(); //Animal没有eat()方法,所以会报错
}
}