Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

adding objects to list

652628Nov 27 2008 — edited Nov 28 2008
Hi,
I am new java. I have a probelm adding objects to list. This is the following code.
class Test{
List <>dataList = new ArrayList<>();

public List<A> getAList(){
dataList.add(new A());
return dataList ;
}
public List<B> getBList(){
dataList.add(new B());
return dataList;
}
}
In the above code what I will pass<parameterized data> to the dataList decalred as member variable?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 26 2008
Added on Nov 27 2008
3 comments
186 views