class Animal{//动物类
public String name="haha";//名字
public void say() {//说话方法
System.out.println(name+" say hi");
}
}
class Cat extends Animal{//猫类继承了动物类
}
public class Test {
public static void main(String[] args) {
Cat cat=new Cat();//实例化一个猫
cat.say();//由于猫继承了动物,所以继承了他所有非private的属性和方法
}
}
class Library{//图书馆
public String name="郑州图书馆";
public void display() {
System.out.println(name);
}
}
class Novel extends Library{//小说
}
class Love entends HistoricalNovel{//历史小说
}
public class Tem{
public static void main(String args[]){
HistoricalNovel lo=new Library();//HistoricalNovel对象指向Library
lo.display();
}
}
public class Father
{
public String name;
public int age;
public String eye;
public String height;
public String cutis;
}
public class Son extends Father
{
public String spectacle frame;
}
public class A{
}
public class B extends A{
}