go to previous page   go to home page   go to next page

Answer:

Yes. Java is used for Web programming because of its convenient security features.


The public Visibility Modifier

The private visibility modifier keeps outsiders from looking in. However, the access methods are intended for outsiders, and must be visible to outsiders in order to be useful. The public access modifier explicitly says that a method or variable of an object can be accessed by code outside of the object.

The public visibility modifier is usually used for all access methods and constructors in a class definition. Most variables are made private. Here is a skeleton of the CheckingAccount class:


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

  CheckingAccount( String accNumber, String holder, int start ) { . . . . }
  
  void incrementUse() { . . . . }
  
  int getBalance() { . . . . }
  
  void  processDeposit( int amount ) { . . . . }
  
  void processCheck( int amount ) { . . . . }
  
}

QUESTION 11:

Pick a visibility modifier for the constructor and for each of the methods.