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
posted
0
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.