Lecture 4
8
Fields and variables
•Variables store values
•A field is one kind of variable
•Fields in an object keep track of object’s state
–String bankName   // Bank.java
–int balance;      // BankAccount.java
•Variables in a method store values needed while that method runs – for example, in Bank.java                                                        boolean moreTransactions;  // line 105    int amount;                // line 119