例:重写方法

public class Peashe extends Plant {
public void action(int a){
    System.out.println("豌豆射手正在左右晃"+a+"下");
}
public void shoot(){
    System.out.println("豌豆射手正在发射");
}
}
public class Plant {
int power;
public void action(){
    System.out.println("植物正在运动");
}





}
public class Planttest {
    public static void main(String[] args) {
    Peashe p=new Peashe();
    p.action();

    
    
    
    
    }

}

 

posted @ 2017-04-11 16:26  苏轼的红烧肉  阅读(109)  评论(0编辑  收藏  举报