How to declare a dynamic object array in Java?

后端 未结 4 1122
一整个雨季
一整个雨季 2020-12-31 02:23

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

4条回答
  •  春和景丽
    2020-12-31 03:21

    You could declare as: Student stu[]=null;, and create it with fixed size: stu[]=new Student[10] until you could know the size. If you have to use array.

提交回复
热议问题