File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Argument Passing Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Argument Passing" Watch "Argument Passing" New topic
Author

Argument Passing

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi,
I know there must be some simple logic to solve this but I couldn't get it.....
Can any one Please help me out of this....
Here is the program given:

The program should be modified so that the method "calculate" must return the calculated value to the method and the new values of a, b, c must be printed after the "calculate" method in test().
Thanks in advance,
KS
[I added UBB CODE tags to your source code to make it more readable. Please try to use them in the future - Ajith]
[This message has been edited by Ajith Kallambella (edited August 30, 2000).]
Bala Murthy
Greenhorn

Joined: Feb 05, 2002
Posts: 4
Hi,
The reason that the variables do not get modified is that a copy of the variables is sent to the method calculate(). Why don't you try wrapping the primitives in their corresponding classes defined in java.lang and passing them as parameters. In this case a reference is passed rather than a copy.

Bala Murthy
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Thank U. I got it...
I tried using array.....
 
 
subject: Argument Passing
 
Threads others viewed
Barry Boone #29
Execution
Why so many Exception Handling classes ?
Reply to Q
need help on 2 queries
developer file tools