I’ve a class
class sampleClass
{
...........
...........
public sampleClass()
{.........}
}
and in another class i created an array like
sampleClass[] X=new sampleClass[]{new sampleClass(),new sampleClass()}
here i gave 2 instance of the constructor. i need this dynamically..
that is the size of the array should be dynamically changed
It sounds like you want something like:
EDIT: If you really want to avoid a for loop, you could do something like:
… but I don’t think that’s actually better than using a loop.