You could create a list of Object like List<Object> list = new ArrayList<Object>() . As all classes implementation extends implicit or explicit from java. lang. Object class, this list can hold any object, including instances of Employee , Integer , String etc.
Read moreHow do you create a list of classes in Java?
Java List Example
Read moreCan a class be a list in Java?
And also, after the introduction of Generics in Java 1.5, it is possible to restrict the type of object that can be stored in the List. Just like several other user-defined ‘interfaces’ implemented by user-defined ‘classes’, List is an ‘interface’, implemented by the ArrayList class, pre-defined in the java .10 Şub 2022
Read moreCan you make a list of classes in Java?
List is just an interface. So you can not instantiate a List . You have to use classes that implements List interface .
Read moreCan you make a list of classes in Java?
List is just an interface. So you can not instantiate a List . You have to use classes that implements List interface .
Read more