Why do I get compiler errors with this Java code?
1 public List extends Foo> getFoos() 2 { 3 List extends Foo> foos = new ArrayList
The following will work fine:
public List extends Foo> getFoos() { List foos = new ArrayList(); foos.add(new SubFoo()); return foos; }