Tuesday, November 29, 2011

How to create the object to the anonomous class

Anonymous classes are classes that don?t have a name (hence the term anonymous). Because they don?t have a name, there is no way to refer to them. For this reason, their declaration must be given at creation time, as part of the new statement.That requires yet another form of the new statement, as follows:new This form of the new statement declares a new anonymous class that extends a given class or implements a given interface. It also creates a new instance of that class and returns it as the result of the statement. The class to extend or the interface to implement is the operand of the new statement, followed by the anonymous class? body.
Category:Java Interview Questions

No comments:

Post a Comment