Monday, November 16, 2009

Puzzle 58 – Solution

There are a couple of solutions possible for this puzzle – I’ll leave figuring out how these solutions work to you!

The first one,

package com.twister;

import java.util.ArrayList;
import java.util.List;

public class Gener {
public void read(List<?> x){}

public static void main(String[] args) {
new Gener().read(new ArrayList<Float>());
}
}


and the second,

package com.twister;

import java.util.ArrayList;
import java.util.List;

public class Gener {
public <Integer>void read(List<Integer> x){}

public static void main(String[] args) {
new Gener().read(new ArrayList<Float>());
}
}

No comments:

Post a Comment

Solution for this question?