Do you want to keep hackers out of your checking account?

A good answer might be:

Yes.

The private Visibility Modifier

When a member of a class is declared private it can be used only by the methods of that class. Here is the checking account class definition from the last chapter with each of its variables declared to be private.

class CheckingAccount
{
  // data-declarations
  private String accountNumber;
  private String accountHolder;
  private int    balance;

  //constructors
  CheckingAccount( String accNumber, String holder, int start )
  {
    accountNumber = accNumber ;
    accountHolder = holder ;
    balance       = start ;
  }

  // methods
  int currentBalance()
  {
    return balance ;
  }

  void  processDeposit( int amount )
  {
    balance = balance + amount ; 
  }

  void processCheck( int amount )
  {
    int charge;
    if ( balance < 100000 )
      charge = 15; 
    else
      charge = 0;

    balance =  balance - amount - charge  ;
  }

}

Now only the methods of a CheckingAccount object can "see" the values in accountNumber, accountHolder, and balance.

QUESTION 2:

It is useless to have a checking account if the balance cannot be changed. How can an application program (such as main()) change the balance of a CheckingAccount object?