Java Reference
In-Depth Information
Display 5.15
Memory Picture for Display 5.14
(part 2 of 2)
is executed
and so the following are executed:
aParameter.name = "Hot Shot";
aParameter.number = 42;
As a result,
ToyClass.changer(anObject);
is changed.
anObject
aParameter
3078
anObject
3078
Someplace else in memory:
3078
Hot Shot
42
Display 5.16
Comparing Parameters of a Class Type and a Primitive Type
(part 1 of 2)
1
public class
ParametersDemo
2 {
3
public static void
main(String[] args)
4 {
5 ToyClass2 object1 =
new
ToyClass2(),
6 object2 =
new
ToyClass2();
7 object1.set("Scorpius",1);
8 object2.set("John Crichton", 2);
9 System.out.println("Value of object2 before call to method:");
10 System.out.println(object2);
11 object1.makeEqual(object2);
12 System.out.println("Value of object2 after call to method:");
13 System.out.println(object2);
14
ToyClass2
is defined in
Display 5.17.