Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
craig long
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • 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.

 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because the class Node doesn't have does methods
 
fred rosenberger
lowercase baba
Bartender
Posts: 12203
35
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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
Bartender
Posts: 12203
35
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • 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.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems like makeEmpty could pretty much be "head = null", no?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic