Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Page 2 of 4
obj1.printHello (); calls the printHello() method. As in obj1.i, obj1. prefixes printHello(). Because Listing 2 also contains obj2.printHello ();, you might think there are two copies of printHello() -- one for each object. Actually, only one copy exists. Its byte codes are loaded when the CODemo2 classfile loads. How does the single copy of printHello() distinguish between the i field in the object referenced by obj1 and the i field in the object referenced by obj2? The answer involves the obj1. and obj2. prefixes. The dot operator that appears between obj1 and printHello() tells printHello() that it can access the i field belonging to obj1 (as opposed to accessing the i field belonging to obj2). The same idea holds for the dot operator that appears between obj2 and printHello(). (I will say more about methods in next month's article.)