Invoking Operations on Business Object Attributes

As well as attributes, some classes have methods which perform operations on the object.

For example, the String class is used to represent a Text attribute’s value, such as the name of a customer. Two of its methods are toUpperCase() and toLowerCase().

lowercaseName = customer.name.toLowerCase();
uppercaseName = customer.name.toUpperCase();

In this example, if the Text attribute customer.name was "Fred Blogs", then the first assignment would set the lowercaseName variable to the value fred blogs, and the second assignment would set the uppercaseName variable to the value FRED BLOGS. In some cases, such as the example cited above, methods can return values. In other cases, methods can alter some of the attributes of the instance. It is important to know how the methods behave when you are using them.