class student
{ String sno,cno,name;
char sex;
int age;
String getsno()
{return sno;}
String getcno()
{return cno;}
String getname()
{return name;}
char getsex()
{return sex;}
int getage()
{ return age;}
void setAge(int a)
{age=a;}
student(String sno,String cno,String name,char sec,int age)
{
this.sno=sno;
this.cno=cno;
this.name=name;
this.sex=sec;
this.age=age;
}
public String tostring()
{
return("学号:"+sno+"班号:"+cno+"姓名:"+name+"性别:"+sex+"年龄:"+age);
}
}
{ String sno,cno,name;
char sex;
int age;
String getsno()
{return sno;}
String getcno()
{return cno;}
String getname()
{return name;}
char getsex()
{return sex;}
int getage()
{ return age;}
void setAge(int a)
{age=a;}
student(String sno,String cno,String name,char sec,int age)
{
this.sno=sno;
this.cno=cno;
this.name=name;
this.sex=sec;
this.age=age;
}
public String tostring()
{
return("学号:"+sno+"班号:"+cno+"姓名:"+name+"性别:"+sex+"年龄:"+age);
}
}
public static void main(String [] ar) {
Student st = new Student ();
System.out.println(st.tostring());
}类名首字母大写Student