I want to ask a question about Java. I have a user-defined object class, student, which have 2 data members, name and id. And in another class, I have to declare that object
Its not possible,we need to specify the size of array when declaring object array;
one way to declare object array
student st[];
st=new student[3];
second way
student st[]=new student[5];
in both cases not any objects are created only the space is allocated for the array.
st=new student[1];
this will create a new object;