
44
Chapter 4: Classes and Objects []
sense to associate a static variable with an object. We prefix static variables with the class name,
as follows:
Account.bankName = "Ealing Bank";
4.7 Instance and Static Methods
As well as instance and static variables, we can also have instance and static (or class) methods.
By default, all methods are instance methods. As we have seen in Section 4.2, instance methods
are invoked by prefixing the method with an object. For example, we invoke the instance method
deposit
fredsAccount, deposit (i00) ;
The deposit method modifies the instance variables corresponding to the fredsAccount object
only. ...