Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Linked List

 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Report post to moderator
Why am I getting an error for using ListNode?
 
Ana Yo
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Report post to moderator

Carey Brown wrote:Please post the full text of the error message.


lesson1.java:6: error: cannot find symbol
     ListNode<String> name = new ListNode<String>();
     ^
 symbol:   class ListNode
 location: class lesson1
 
Carey Brown
Bartender
Posts: 6140
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
It can't find "ListNode". Is this a class that you wrote? If not, where do you expect the compiler to find it?
 
Ana Yo
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Report post to moderator

Carey Brown wrote:It can't find "ListNode". Is this a class that you wrote? If not, where do you expect the compiler to find it?


Our teacher was using ListNode so I assumed this was already a Java built in class
 
Ana Yo
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Report post to moderator

Carey Brown wrote:It can't find "ListNode". Is this a class that you wrote? If not, where do you expect the compiler to find it?


How would you suggest I fix this error? Can you show me please?
 
Carey Brown
Bartender
Posts: 6140
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Learn to look things up in Oracle's Javadocs. And, no it isn't in there.

Is this something you're expected to write?
 
Ana Yo
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Report post to moderator

Carey Brown wrote:Learn to look things up in Oracle's Javadocs. And, no it isn't in there.

Is this something you're expected to write?


No, today was my first day learning LinkedList so I was watching videos and testing it in my Java software but instead of using LinkedList I used ListNode because that is what our teacher used.
 
Ana Yo
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Report post to moderator

Carey Brown wrote:Learn to look things up in Oracle's Javadocs. And, no it isn't in there.

Is this something you're expected to write?



Would you happen to know how to do this? I have many other problems but if you can show me how to do this one then I can use your solution  as a guide to figure out the other problems.
node.jpg
[Thumbnail for node.jpg]
 
Ana Yo
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Report post to moderator
Actually, I know how to do a while loop for it but not a for loop
 
Saloon Keeper
Posts: 10539
224
  • Mark post as helpful
  • send pies
  • Report post to moderator
It seems to me that you need to write the list node yourself. By the way, you don't need the import declaration, because I don't think you're going to be using the standard LinkedList class.
 
Marshal
Posts: 65466
249
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please continue all discussion here. You have two threads with the same name, and I am closing this one.
 
When you have exhausted all possibilities, remember this: you haven't - Edison. Tiny ad:
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!