子类
父类
public class Michael extends Mouse{
private int IQ;
public Michael(int id,int age,int IQ){
super(id,age);
this.IQ=IQ;
}
public String toString(){
System.out.print(age+","+id+","+IQ);
return age+""+id+""+IQ;
}
public static void main(String[] agrs ){
Mouse mic= new Michael(454,4545,454);
mic.toString();
}
}
父类
public class Mouse{
protected int id;
protected int age;
public Mouse(int id,int age){
this.id=id;
this.age=age;
}
public String toString(){
return id+""+age;
}
/*
继承 不能重写 final 和静态变量
public static void main(String[] agrs){
Mouse mouse = new Mouse(123,12);
mouse.toString();
}*/
}