Why this is wrong:
Class extends Number> type = Integer.class;
ArrayList = new ArrayList<>();
?
I
ArrayList = new ArrayList<>();
this line is wrong. First, you missed identifier (variable name) here; Second, you mixed the concepts of "type" and "class". You can delcare
ArrayList list = new ArrayList<>();
But according to yours, type = Integer.class. Obviously, Integer is not equivalent to Integer.class. Similarly you can't have Integer.class i = 1; The former one is a "type", the second one is a "Class" object.
You can create a generic method:
public List createAList (Class type) {
return new ArrayList();
}