java Programming Glossary: changereference
Is Java really passing objects by value? [duplicate] http://stackoverflow.com/questions/7893492/is-java-really-passing-objects-by-value Main public static void main String args Foo f new Foo f changeReference f It won't change the reference modifyReference f It will change.. the object that the reference refers to public static void changeReference Foo a Foo b new Foo b a b public static void modifyReference.. and it's initially assigned to null . public static void changeReference Foo a 3 As you call the method changeReference the reference..
Java pass by reference http://stackoverflow.com/questions/9404625/java-pass-by-reference Main public static void main String args Foo f new Foo f changeReference f It won't change the reference modifyReference f It will modify.. that the reference variable f refers to public static void changeReference Foo a Foo b new Foo b a b public static void modifyReference.. and it's initially assigned to null . public static void changeReference Foo a As you call the method changeReference the reference a..
|