回覆列表
  • 1 # 山西維信科技

    class Animal{

    public String kind;

    void eat(){

    }

    void sleep(){

    }

    }

    class Fish extends Animal{

    String kind="Fish";

    void eat(){

    System.out.println(kind+" eating");

    }

    void sleep(){

    System.out.println(kind+" sleeping");}

    }

    class Dog extends Animal{

    String kind="Dog";

    void eat(){

    System.out.println(kind+" eating");

    }

    void sleep(){

    System.out.println(kind+" sleeping");}

    }

    public class E {

    public static void main(String agrs[]){

    Fish f=new Fish();

    Dog d=new Dog();

    f.eat();

    f.sleep();

    d.eat();

    d.sleep();

    }

    }

  • 中秋節和大豐收的關聯?
  • 鉑金鑽戒究竟依靠什麼魔力摘得“求婚必備品”桂冠?