wood burning stoves 2.0*
The moose likes Cattle Drive and the fly likes Stuck with stubborn return values - please give hints Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Stuck with stubborn return values - please give hints" Watch "Stuck with stubborn return values - please give hints" New topic
Author

Stuck with stubborn return values - please give hints

juliane gross
Ranch Hand

Joined: May 30, 2002
Posts: 161
My main method calls a method no1, which is calling a method no2 three times in a row.
Now I wish that method2 would return either value x or value y
(depending on some if-else results) to method1, so that method1 continues calling
method no2 with that newly changed value.
But method no1 stubbornly calculates in all three calls with the value it got from the
main method no matter what the return value was from method no2.
My question: how can I "convince" method no1 to accept the return value of method no2
and forget about the given value in the main method?
thank you for your patience of answering this (probably very green) question..

juliane
Ronald Schindler
Ranch Hand

Joined: Jul 11, 2000
Posts: 50
Hey Juliane,
without seeing code its a little hard to make a definite determination. But it sounds as if you have the variable being set with the first method each time it is called. You might want to try looking at the scope of the variable within the first method.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Are you saving the value that was returned? Did you assign it to an identifier?


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
juliane gross
Ranch Hand

Joined: May 30, 2002
Posts: 161
thank you for bothering, Ronald and Marilyn!
I had my program running 2 minutes after your
hints, thank you!! (and even smaller )
Juliane
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stuck with stubborn return values - please give hints
 
Similar Threads
Polymorphism and "this" keyword, an interesting Q..
good desktop application architecture with JSR-295 beansbinding?
Overriden Method Query
Error message relating to Static variables
how to achieve this ?