posted 24 years ago
Anonymous Classes
Some classes that you define inside a method do not need a name. A class defined in this way without a name is called an anonymous class. An anonymous class gives you a convenient way to avoid having to think up trivial names for classes
The class is instantiated and declared in the same place.
The declaration and instantiation takes the form
new Xxxx ()
{
//body
}
where Xxxx is an interface name.
An anonymous class cannot have a constructor. Since you do not specify a name for the class, you cannot use that name to specify a constructor.
Abstract Classes
Sometimes, a class that you define represents an abstract concept and, as such, should not be instantiated. An abstract class is a class that can only be subclassed.
An abstract class may contain abstract methods, that is, methods with no implementation. In this way, an abstract class can define a complete programming interface, thereby providing its subclasses with the method declarations for all of the methods necessary to implement that programming interface. However, the abstract class can leave some or all of the implementation details of those methods up to its subclasses.
Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD