Search Interview Questions
| More than 3000 questions in repository.|
There are more than 900 unanswered questions.
Click here and help us by providing the answer.
Have a video suggestion.
Click Correct / Improve and please let us know.
|Java - Interview Questions and Answers|
|Ans. Anonymous classes are defined in the new expression itself, so you cannot create multiple objects of an anonymous class.|
You cannot explicitly extend a class or explicitly implement interfaces when defining an anonymous class.
An anonymous inner class is always created as part of a statement; don't forget to close the statement after the class definition with a curly brace. This is a rare case in Java, a curly brace followed by a semicolon.
Anonymous inner classes have no name, and their type must be either a subclass of the named type or an implementer of the named interface
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve  java   oops   inner classes   anonymous inner classes   classes Asked in 1 Companies|