I am trying to make a generic List that can contain only Numbers. When i try to add an Integer to it, it gives the following error.
add(T) in List cannot be applied to Java.lang.Number
public class QueryHelper<T extends Number> {
private List<T> records;
public void query(QueryTypes queryType) {
records = new ArrayList();
records.add((Number)new Integer(90));
}
}
What is causing this problem?