When I try:
LinkedList<String> stringList = new LinkedList<String>();
I get the following compilation error:
type LinkedList does not take parameters
What am I missing? Can't you do this?
Don't take the class name as class LinkedList instead you can take class LinkedListDemo and rest of the declaration LinkedList<String> t = new LinkedList<String>(); should be there and it will compile perfectly.
Check to make sure you don't have a compiled class named LinkedList in the same directory. (Especially since "linked list" is a common term, and it is something that people often try to implement as beginners.) This is important if you import your classes using something like import java.util.*;, because the * imports on-demand, so if there is a class with the same name in the package already, then that class is used and the java.util.LinkedList is not imported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With