2.x.1 Anonymous classes in Java

In Java, a singular object is called an anonymous class and account_1010 may be written as an anonymous class. The singular object account_1010 may be written as an anonymous class as shown in the following example:

object account_1010 = new Object(){
   String Owner;   float balance;
   float interestRate;
   addInterest() {
      balance = balance + (balance * interestRate) / 100;
   }
   deposit(real amount) {
      balance = balance + amount;
   }
   real withdraw(real amount) {
      balance  = balance - amount;
      return balance;   }}

However, anonymous classes are not a good way to define singular objects like account_1010 since there is a lot of restrictions on these. You may e.g. not invoke a method as in account_1010.addInterest.

+++ more?