Hi I have a list of objects,
myclass obj1 = new myclass();
myclass obj2 = new myclass();
obj1.name("hello");
obj2.name("bye");
List objectsList = new ArrayList
objectsList.add(obj1);
objectsList.add(obj2);
how can I access to methods of each object in the list?
I have tried the following but I dont have access to methods.
Object obj = objectsList.get(1);
obj. <<< no access to methods
You need to cast them to myclass.