• 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

Errors, Help on Jcreator?!

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So this is my code:


Now, when i do compile with Jcreator, it gives me the following errors:

error 1: line 13, 16 , 18 ---> cannot find symbol variable result even though i declared it in line 26 as LinkList result = new LinkList();

*2nd request: i want the main method to display the result list and when i do so it only says process completed?!

SO please help me?!
Thank youu so much!!
 
Marshal
Posts: 79471
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have declared the result variable as a local variable in the main method. You should keep the main method as small as possible; the ideal is one statement.

And the local variables in the main method do not exist in any other methods, unless you pass a reference.
 
Nadine Ernest
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
heres the thing,
i cant use any reference manipulation so i really cant figure out a way to fix these errors!!
Help!!
 
author
Posts: 23956
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nadine Ernest wrote:heres the thing,
i cant use any reference manipulation so i really cant figure out a way to fix these errors!!
Help!!



What does this mean? What do you mean you can't do "reference manipulation"?

Henry
 
Campbell Ritchie
Marshal
Posts: 79471
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does "reference manipulation" mean?

You have a method which takes two Lists as its parameters and returns a List which you aren't using. You need to declare the result List in the method, then you have another local variable. And you need to use whatever that method returns. So you need to work out how to put those two together. And also how to get rid of the infinite recursion in the union method.

Don't use the == operator to test whether the members of the two Lists are equal to each other. Use their equals() method. Every Object has an equals() method.
It is unlikely that you will have access to a data field of the contents of your Lists. You ought to make whichever type you are putting into the Lists implement the Comparable interface, then use its compareTo() method. You might be able to say List<Comparable> but I am not quite sure about that.

You will have to look very carefully at the "if-elses" and go through them with a pencil and paper; what will happen if a == b, what will happen if a < b and what will happen if a > b.
 
Nadine Ernest
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By"reference manipulation" i mean that i cannot say:

same with

 
Campbell Ritchie
Marshal
Posts: 79471
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
List1.first? That suggests you haven't got your fields labelled private as they ought to be. You should be writing list1.getFirst(), or list1.removeFirst() as you did earlier.

"Reference manipulation" (as you will have seen from the comments yesterday) is not a phrase we are familiar with.
 
Nadine Ernest
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh yeah you're right!!
i got it!!

thanks a lot campbell ritchie!!
you ve been great help!
 
Campbell Ritchie
Marshal
Posts: 79471
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome
 
reply
    Bookmark Topic Watch Topic
  • New Topic