If we initialize an array of a custom class MyClass.java like this MyClass myClass = new MyClass; then how can we instantiate member variable of that class through its setters methods?
e.g to instantiate a "name" data member variable of MyClass.java, how can we instantiate this "name" variable.
myClass = new MyClass (arg); and so on...
Thanks for reply. But I forgot to mention that actually MyClass.java has a default constructor so it can't take any parameter while creating new instance of it. So, finally I have come to following solution: MyClass myClass = new MyClass; myClass[i] = new MyClass(); myClass[i].setName("Person"); where i is the index of element of the array myClass that is being instantiated.