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
User ArrayList instead. It'll expand automatically as you add new elements. Later you can convert it to array, if you need.
ArrayList
As another option (not sure what exactly you want), you can declare Object[] field and not initialize it immediately.
Object[]