标签:ati 结构 技术 void string 数据 extends turn 成绩
public class Father {
public String str1="孙黛娜";
public int x=20;
public String str2="女";
public String toString()
{
return str1+","+str2+","+x;
}
}
public class son extends Father {
public String s1;//学院
public String s2;//专业
public String s3;//科目
public int i;//成绩
public son(Father a,String s1,String s2,String s3, int i )//构造函数
{ this.s1=s1;
this.s2=s2;
this.s3=s3;
this.i=i;
}
public String toString()
{
return super.toString()+","+s1+","+s2+","+s3+","+i;
}
public static void main(String[] args) {
Father a=new Father();
son b=new son(a,"计算机学院","计算机科学与技术","数据结构",60);
//son c=new son(b);
System.out.println(b.toString());
}
}
标签:ati 结构 技术 void string 数据 extends turn 成绩
原文地址:http://www.cnblogs.com/sdn1229/p/6777871.html