Answer Posted / preetesh
An Anonymous class is an inner class that is not assigned a
name. It is defined and instantiated within arguments of a
method of the Outer Class.
Syntax is as follows:
----------------------
public class OuterClass
{
//some relevant code
methodName(new ClassName(){ }); /*It indicates compiler
that the code between the braces in the argument of the
method defines an anonymours inner class.*/
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is the static block?
What is the difference between compare and compareto in java?
Is map ordered in java?
What is use of arraylist in java?
What are use cases?
What if constructor is protected in java?
What is difference between protected and private?
What is encapsulation in java?
What is split return?
What is an exception in java?
Does java runtime require a license?
Can we execute a program without main?
Why is java called the platform independent programming language?
Is null keyword in java?
How to instantiate static nested classes in java?