Hi All,
I need to create an ArrayList or HasMap in a class which stores objects in it.
For example:
class A{
public String A;
public String B;
ArrayList array = new ArrayList();
public String getStringA(){
return A;}
public void setStringB(String xys){
B= xyz;
return B;
}
public ArrayList getTest(){
return ArrayList;
}
But the problem I have is I need this Array List to hold objects.
In other terms, the ArrayList should be hold an Object containing 3 Strings.
Say Object1:
Its structure should be like:
Obj1{
String 1;
String 2;
Strng 3;
}
Can i create an Object within a class not by instantiating.
I am wondering if to create a class which holds these 3 Strings and then instantiate in this class or create an Inner class within this class.
Which do you think is a better practice.
Hope I am clear with my question. I need a urgent response. Please respond ASAP.
Thanks