Static Fields

public class BankAccount
 {
    . . .
    private double balance;
    private int accountNumber;
    private
static int lastAssignedNumber = 1000;
 }

public BankAccount()
 {
    // Generates next account number to be assigned
    lastAssignedNumber++; // Updates the static field
    // Assigns field to account number of this bank account
    accountNumber = lastAssignedNumber; // Sets the instance field
}

  public class BankAccount
{
   . . .
   private static int lastAssignedNumber = 1000;
      // Executed once,
      // when class is loaded
}

public class BankAccount
 {
    . . .
    private double balance;
    private int accountNumber;
    private
static int lastAssignedNumber;
   
static
    {
      lastAssignedNumber =1000;
    }

 }

public class BankAccount
{
   . . .
   public static final double OVERDRAFT_FEE = 5; //
      Refer to it as
      // BankAccount.OVERDRAFT_FEE
}

Name two static fields of the System class.

   Answer: System.in and System.out.