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
Post a Comment