class Dog{}
public void foo(Dog d)
{
d.serName("Fifi");
}
Dog myDog; //my Dog is a reference to a object of type Dog
myDog = new Dog();
foo(myDog); // The reference myDog to a object of type Dog is passed by Value
Result:
Dog name is changed to Fifi
http://javadude.com/articles/passbyvalue.htm
http://www.geocities.com/mcglonec1978/javacert/paramPassing_highres.html
Monday, September 8, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment