Hello
Does anyone know why the following code does not compile and during compilation I get incompatible types exception ?
public class Test<T> {
public static void main(String[] args)
{
// using Test<?> solves the compilation error
Test test = new Test();
// getting error incompatible types:
// found : java.lang.Object
// required: java.lang.Integer
Integer number = test.getDays().get(0);
}
private List<Integer> getDays() {
return new ArrayList<Integer>();
}
}
and why using Test with the unbounded wildcard solves this ? I'm using java version 1.6.0_12