Hi guys,
here I am with another Java Challenge. Looking at the following code, are you able to say where does it fail??
—
import java.util.ArrayList;
import java.util.List;
public class GenericsHandler {
public void insert(List list) {
list.add(new String(“42”));
}
public static void main(String[] args) {
GenericsHandler gh = new GenericsHandler();
List<Integer> list = new ArrayList<Integer>();
gh.insert(list);
System.out.println(list.size());
System.out.println(list.get(0));
}
}
—
Next post, I’ll come with the answer.
—
Fernando