File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes compiler will not accept setprev or getprev to make doubly linked listin Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "compiler will not accept setprev or getprev to make doubly linked listin " Watch "compiler will not accept setprev or getprev to make doubly linked listin " New topic
Author

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

craig long
Greenhorn

Joined: Jan 19, 2010
Posts: 7
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

Joined: Oct 25, 2008
Posts: 2700

Because the class Node doesn't have does methods


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11314
    
  16

Can you point us to the code that calling setPrev() would execute? I don't see such a method defined in your Node class.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
craig long
Greenhorn

Joined: Jan 19, 2010
Posts: 7
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

Joined: Oct 02, 2003
Posts: 11314
    
  16

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

Joined: Sep 29, 2008
Posts: 12617

Seems like makeEmpty could pretty much be "head = null", no?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: compiler will not accept setprev or getprev to make doubly linked listin