public class Student {
private String name;
private int idNO;
private int age;
private int weight;
private int height;
public Student(String name,int idNO,int age,int weight,int height){
this.name = name;
this.idNO = idNO;
this.age = age;
this.height = height;
this.weight = weight;
}
public void display(){
System.out.println("Name :"+this.name+" ID NO :"+this.idNO+" Age : "+this.age+" Weight : "+this.weight+" Height : "+this.height);
}
public static void main(String[] arg){
Student[] a = {new Student("James",58001,13,177,90),
new Student("Jane",58002,15,140,60),
new Student("John",58003,17,156,54),
new Student("Jonas",58004,20,188,70)};
int i =0;
while(i<a.length){
a[i].display();
i=i+1;
}
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น