2-dimensional arrayList?

Hi,

can anyone tell me what is wrong with the following code snippet?

List<List><String>> list = new ArrayList<List><String>>();

List<String> l = new ArrayList<String>();

list.add(l);

When I try to compile I get an error for the third line: <identifier> expected.

P.S.: The closing '>' signs after "<List" are being added automatically.

I don't know how to suppress that.>

[488 byte] By [maximiliana] at [2007-11-27 3:09:42]
# 1
You get that error because those lines of code aren't inside a method or constructor. The first two lines are declarations so they don't have to be in a method or constructor, but the third is an assignment statement that must be.
DrClapa at 2007-7-12 3:58:50 > top of Java-index,Core,Core APIs...
# 2
HitryList< List<String> > list = new ArrayList< List<String> >();List<String> l = new ArrayList<String>();list.add(l);
MakAslama at 2007-7-12 3:58:50 > top of Java-index,Core,Core APIs...
# 3
Hi, you are two months late, and wrong, and the correct answer was provided two months ago.
ejpa at 2007-7-12 3:58:50 > top of Java-index,Core,Core APIs...