Click to See Complete Forum and Search --> : How can I create an array of object?


Zulfi Khan
August 9th, 1999, 05:25 AM
I have got a class. I want to create an array of object for that class holding 100 elements.
Zulfi

ramu
August 9th, 1999, 06:18 AM
try this code
Let your class Name is MyClass
MyClass myClass[];
myClass = new myClass[100];

August 11th, 1999, 09:37 AM
hai,
If U want to create an array of String objects, U do it like this...
String stringArray[] = new String[100];
This creates a 100 element array of objects belonging to the class String

Similarly, if U want to create an array of 100 objects of class YourClass, U do it like this...
YourClass yourClassObjects[] = new YourClass[100];

thanx,
devi prasad
devi_prasad@mailcity.com