对象

public class students {
String name;
 char sex;
 int num;
 int Chinese;
 int Enghlish;
 int Math;
 int avg;

public static void main(String[] args) {
students stu1 =new students();//声明并实例化students类对象stu1
students stu2 =new students();//声明并实例化students类对象stu2
students stu3 =new students();//声明并实例化students类对象stu3
students stu4 =new students();//声明并实例化students类对象stu4
stu1.name = "杨";
stu1.sex ='女';
stu1.num = 162507;
stu1.Chinese =100;
stu1. Enghlish=100;
stu1. Math =100;
stu1. avg = 100;
stu2.name = "高";
stu2.sex ='男';
stu2.num = 162507;
stu2.Chinese =100;
stu2. Enghlish=100;
stu2. Math =100;
stu2. avg = 100;
stu3.name = "章";
stu3.sex ='女';
stu3.num= 162507; 
stu3.Chinese =100;
stu3. Enghlish=100;
stu3. Math =100;
stu3. avg = 100;
stu4.name = "邓";
stu4.sex ='女';
stu4.num= 162507;
stu4.Chinese =100;
stu4. Enghlish=100;
stu4. Math =100;
stu4. avg = 100;
System.out.println(" 姓名 "+"   性别"+"     学号   "+"        语文 "+"      英语 "+"      数学 "+"    平均值 ");
System.out.println(""+stu1.name+ "  "+stu1.sex+"   "+stu1.num+"  "+stu1.Chinese+"  "+stu1. Enghlish+"  "+stu1. Math+"  "+stu1. avg);
System.out.println(""+stu2.name+ "  "+stu2.sex+"   "+stu2.num+"  "+stu2.Chinese+"  "+stu2. Enghlish+"  "+stu2. Math+"  "+stu2. avg);
System.out.println(" "+stu3.name+ "    "+stu3.sex+"   "+stu3.num+"  "+stu3.Chinese+"  "+stu3. Enghlish+"  "+stu3. Math+"  "+stu3. avg);
System.out.println(""+stu4.name+ "  "+stu4.sex+"   "+stu4.num+"  "+stu4.Chinese+"  "+stu4. Enghlish+"  "+stu4. Math+"  "+stu4. avg);
}

}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值