
42
Chapter 4: Classes and Objects []
The output of running
CreateEmployee will
now be as follows:
>
java CreateEmployee
amount within method' 510
amount outside method' 510
4.6 Instance and Static Variables
By default, class member variables are instance variables. In the Account class shown next,
accountNo, accountName, and balance are all instance variables.
Account
1 class Account {
2
int accountNo;
3
String accountName;
4
double balance;
5 }
Account
Whenever an object, or instance, of the class is created, copies of the instance variables
are created. In CreateAccount, two instances of the ...