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
Why are getters and setters used?
Is boolean a data type in java?
What are the main uses of java?
How do you make an arraylist empty in java?
What is a parameter example?
Can a class be private in java?
What is a lambda expression ? What's its use ?
What is the purpose of garbage collection in java, and when is it used?
What is unicode with example?
What is nested loop? What is dangling else condition in it?
What is nullpointerexception in java?
Can we override the overloaded method?
Can we declare array without size in java?
What is off heap memory?
What is treeset in java?