Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Recieve value from another method

 
Pol Appan
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

I have a method like this



I have another method



How can I recieve value of first method loadUser in my second method?
I do not want to add another parameter to prepareSession method because it is over riding.

How can I achieve this?

Thanks
 
Campbell Ritchie
Sheriff
Pie
Posts: 49733
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would it work to make the currentUser variable a field instead?
 
Pol Appan
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No didn't work
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I assume your methods are in the same class. Declare the currentUser as an instance variable. eg



bye for now
sat
 
Pol Appan
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok.


String bn = "myString";



I did like this





In prepareSession I called as this.bn, bn is showing as myString.

My question how to call bn is prepareSession method. I would lik to use bn in prepareSession method.
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your method



bye for now
sat
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic