|
A good answer might be:x = 3; y = 5 Enter PointDoubler x = 3; y = 5 x = 6; y = 10 Leave PointDoubler x = 6; y = 10 | |
Still Call by Value
Here are two facts:
These facts are consistent with call by value. The "value" is the reference to the object. The invoked method has its own copy of this value and can't change the copy of the invoking method. However, it can change the object. Of course, even if a method has a reference to an object, the object can be changed only if the object allows changes to be made (either with public instance variables or through access methods.) | |
QUESTION 12:Look at the definition of the MyPoint class. Think of a way to make MyPoint objects immutable. Click Here after you have answered the question |