Advertisement
glee20

Student Test

Oct 16th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. public class StudentTest {
  2.     public static void main (String args[]) {
  3.         Student studentList [] = new Student [4];
  4.         studentList[0] = new Student ("Amy",11,"Female","Korean");
  5.         studentList[1] = new Student ("Ben",6,"Male","English");
  6.         studentList[2] = new Student ("Cat",19,"Female","Chinese");
  7.         studentList[3] = new Student ("Dave",14,"Male","French");
  8.        
  9.         for (int x=0; x<4; x++) {
  10.             System.out.println("Student No." + x);
  11.             System.out.println("Name : " + studentList[x].getName());
  12.             System.out.println("Age : " + studentList[x].getAge());
  13.             System.out.println("Gender : " + studentList[x].getGender());
  14.             System.out.println("Nationality : " + studentList[x].getNation());
  15.             System.out.println("");
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement