您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes
Introduction
Content
Apply
Reflect
Extend
previous.gif
 (3087 bytes)
next.gif
 (2959 bytes)

 
 
Content Index
Content Page # 25

More about the 'dot' notation

Java uses the dot notation for the sending of messages to other objects (and methods). For example, if a method in a different class wants to send a message to invoke the method printBalance() for a particular object of class customer, we could write (assuming the object is called aCustomer):

aCustomer.printBalance();
This means `send the message printBalance() to the object aCustomer'. This would, had we defined the Customer class appropriately, result in the printBalance() method being invoked for the object aCustomer.

The dot notation can also be used to send messages to receive values of variables from objects. Thus the statement:

aCustomer.familyName;
is a message that will result in the aCustomer object returning the value of its familyName variable (as long as this variable is public ?see later this unit).

Back to top

basicline.gif (169 bytes)

RITSEC - Global Campus
Copyright © 1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg