[Resolved] Cannot instantiate the type Listin java | Eclipse | Compile time error – 2022

Issue: I’m facing compile time error “Cannot instantiate the type List” while creating list object.

Reason: As we are creating instance for interface, it is not allowed in java. Interfaces cannot be instantiated. That means we are trying to create instance for List interface.

Solution: We can use implementation Classes to create instances. Example we can use ArrayList, LinkedList etc classes to create instance of the List interface as these classes are implementations of List interface.

If you got solution for your issue, please write it in comment section. Do let me know if you still facing same issue or different issue.