+ 1

How Can I Instantiate an Object that is an Array?

I want to instantiate an object that is an array. Like using structs in C. For example: struct example{ int data; int key; }; struct example* blabla[100]; How can I do this in Java with classes?

18th Aug 2017, 2:39 PM
Yusuf
Yusuf - avatar
2 ответов
+ 3
class example{ int data; int key; } Instantiate it like: example obj = new example(); Or, with arrays: exampe[] array2 = {new example()}; example[] array3 = new example[5]; // same thing as any other array
18th Aug 2017, 3:01 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
I know this method. But I didn't know how to use it. Now I got it. Thank you.
18th Aug 2017, 4:44 PM
Yusuf
Yusuf - avatar