Instance variables

  1. Instance variables is used to store information on individual objects

  2. Instance variables are created by the new operator

  3. All instance variables defined in the class are created at the same time by the new operator

  4. Different objects do NOT shared the instance variables

  5. Example:

          BankAccount harrysChecking = new BankAccount();     
          BankAccount momsSaving = new BankAccount();

  6. The lifetime of instance variables:

  7. How can there be no reference variables that refer to an object:

  8. Scope of instance variables: