A good answer might be:

No. The program will not compile.


New display() Method

Here is what the compiler outputs for the mistaken program:

compiling: CheckingAccountTester.java

CheckingAccountTester.java:55: 
No method matching incrementUse() found in class CheckingAccount.
    bobsAccount.incrementUse();
                            ^
CheckingAccountTester.java:56: 
Variable useCount in class CheckingAccount not accessible from class CheckingAccountTester.
    bobsAccount.useCount = 15;
               ^
2 errors

The main() method cannot use the private variable useCount nor can it use the private method incrementUse(). These can only be used by the other methods of the object. The main() method can use bobsAccount.processCheck( ) which is not private. It in turn uses the private method incrementUse(). This is OK.

It would be nice to have a display() method in this class that shows the use count as well as the other data. Here is the display() method from the previous chapter:

class CheckingAccount
{
  private String accountNumber;
  private String accountHolder;
  private int    balance;
  private int    useCount = 0;
  . . . .

  void display()
  {
    System.out.println(  accountNumber + "\t" + accountHolder + "\t" +  balance );
  }

}

QUESTION 10:

Modify the method so that it also prints out the use count.