class human{ private String name; private String addr; private char sex; private int age; public human(){ } public human(String name,String addr,char sex,int age){ super(); this.name=name; this.addr=addr; this.sex=sex; this.age=age; } public String toString(){ return "姓名:"+this.name+" 地址:"+this.addr +" 性别:"+this.sex+" 年龄:"+this.age; } } class Student8 extends human{ private double math; private double english; public Student8(){ } public Student8(String name,String addr,char sex,int age,double math, double english){ super(name,addr,sex,age); this.math=math; this.english=english; } public String toString(){ return super.toString()+" 数学成绩:"+this.math+" 英语成绩:"+this.english; } } public class per01 {
/** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Student8 stu=new Student8("小崔","北京怀柔区xx泉小区",'男',22,99.0,99.0); System.out.println(stu); }
}