• Post Reply 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

compiler will not accept setprev or getprev to make doubly linked listin

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when compiled the following program returns "Cannot find symbol method SetPrev(LinkedList.Node)" line 133 and Cannot symbol method getPrev()" line 186. Everything seems to be in place. Please Help.

 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because the class Node doesn't have does methods
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you point us to the code that calling setPrev() would execute? I don't see such a method defined in your Node class.
 
craig long
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Makes sense now. Got it fixed. Thanks for pointing it out. Sometimes while trying something new I look at all the lines of code and simply can't see what it needs.
 
fred rosenberger
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The compiler messages are actually very helpful. If it says "I can't find a method" (as in this case), I always try to find the method myself. I cut-n-paste the EXACT method name it says it can't find. I turn on "match by case" since java is case sensitive, and then I search for the method. If I can't find it, the compiler probably can't either.

If I CAN find it, then I start digging deeper. Is the method signature correct/match? are the access modifiers correct? Did I include the correct CLASSPATH, etc.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seems like makeEmpty could pretty much be "head = null", no?
reply
    Bookmark Topic Watch Topic
  • New Topic