c#编写学生类,实例化3个对象,计算平均年龄
展开全部
public class StudentTest { public static void main(String[] args) { Student[] test = {new Student("01","阿猫"),new Student("02","阿狗"), new Student("03","阿花")}; for(Student a : test) { System.out.println(a); } }}class Student { String no; String name; Student(String no ,String name) { this.no = no; this.name = name; } public String toString() { return "学号 :"+ no + " "+"姓名 :" + name; }}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询