- 1

Help me to fix this error

import java.util.Links; public class Links { public static void main(String[] args) { LinkedList Links = new LinkedList; Links.add(1); Links.add(2); Links.add(3); Links.add(4); Links.add(5); System.out.println(Links); } }

9th Oct 2021, 8:50 AM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
2 Respostas
+ 5
Incorrect or invalid declaration of LinkedList.. Here you go import java.util.*; public class Links { public static void main(String[] args) { LinkedList <Integer> Links = new LinkedList<>(); Links.add(1); Links.add(2); Links.add(3); Links.add(4); Links.add(5); System.out.println(Links); } }
9th Oct 2021, 8:59 AM
Rupali Haldiya
Rupali Haldiya - avatar
+ 2
Please always tag the language you're asking about and use meaningful titles. Don't expect people to put effort into helping you if you're not even willing to put any effort into asking your question. https://www.sololearn.com/Content-Creation-Guidelines? https://code.sololearn.com/Wv5gTHy1N6Ji/?ref=app https://www.sololearn.com/discuss/1316935/?ref=app https://code.sololearn.com/W3uiji9X28C1/?ref=app https://www.sololearn.com/discuss/333866/?ref=app
9th Oct 2021, 9:14 AM
Simon Sauter
Simon Sauter - avatar