面向对象抽象类
package chouxiang.interfaces;
public interface Flyable {
void eat();
package chouxiang.interfaces;
public class LaoYin extends Bird {
private int Flyable;
@Override
public void eat() {
// TODO Auto-generated method stub
System.out.println("老鹰会翱翔");
}
}
package chouxiang.interfaces;
public class spadger extends Bird {
private int age;
private double weight;
public void eat() {
// TODO Auto-generated method stub
System.out.println(“麻雀是害虫”);
}
}
package chouxiang.interfaces;
public class Tese1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
spadger a= new spadger();
a.setWing(2);
a.setLegs(2);
a.eat();
System.out.println(a.getWing());
}
}