Java Challenge (3)


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>();



Next post, I’ll come with the answer.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s