Please Help
Submitted by sunny503 on Thu, 01/28/2010 - 09:17
I have written a code:
/*
class GHJ{String s;GHJ(String s){this.s=s;}}
class DFR{
public static void main(String[] g){
List<? extends Object> list=new ArrayList();
list.add((new String("ffg")));
list.add("df");
list.add("sdd");
list.add(new GHJ("dff"));
String s=list.get(0);
System.out.println(list+" "+s);
}
}
*/
but it is not compiling, but afaik the type of List can take any type which extends the Object.So it can take String type.
people can u help me??
- Login to post comments
