Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
Hello! /// Code start class Swap { System.out.println(" Inside swap method."); temp = obj1; System.out.println("obj1.value = " + obj1.value); public static void main(String [] args) { obj1.value = 10; System.out.println("Inside main method."); swap(obj1, obj2); System.out.println("After swap method."); The program output was very surprised: Inside main method. If all object pass to a method by refference than after swap method its values should be changed... I don't understand why its didn't. Thank you. I am sorry for a big message. Replies:
|
Sponsored Links
|