How to declare a dynamic object array in Java? -


i want ask question java. have user-defined object class, student, have 2 data members, name , id. , in class, have declare object[], (e.g. student stu[?];). however, don't know size of object array. possible declare object array don't know size? thank you.

user arraylist instead. it'll expand automatically add new elements. later can convert array, if need.

as option (not sure want), can declare object[] field , not initialize immediately.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -