Java Reference
In-Depth Information
y 0
count 0
illusObject1
x
3
illusObject2
x
5
FIGURE 8-15 illusObject1 and illusObject2
Now consider the following statement:
Illustrate.incrementY();
Illustrate.count++;
After these statements execute, the objects and static members are as shown in Figure 8-16.
y 1
count 1
illusObject1
x
3
illusObject2
x
5
FIGURE 8-16 illusObject1 and illusObject2 after the statements Illustrate.
incrementY(); and Illustrate.count++; execute
The output of the statement:
System.out.println(illusObject1);
is:
x = 3, y = 1, count = 1
Similarly, the output of the statement:
System.out.println(illusObject2);
is:
x = 5, y = 1, count = 1
Now consider the statement:
Illustrate.count++;
 
Search WWH ::




Custom Search