java storing objects in array

时间:2018-10-17 12:52:16

标签: java arrays object

public static void main(String[]args) {
   Student stud1=new Student();
   stud1.setName("Amy Kelly");
   stud1.setIdnumber(17357389);
   stud1.setCourse("2BA");



   Student[] studentArray;
   studentArray=new Student[3];
   studentArray[0]=stud1;

   System.out.println("Student 1 details:"+ studentArray[0]);

the output for this is Student 1 details:Student@5ccd43c2 Which is the address, what am I doing wrong that its not printing out the object variables ?

0 个答案:

没有答案