+ 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?
2 Antworten
+ 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
+ 1
I know this method. But I didn't know how to use it. Now I got it. Thank you.