What is anonymous class?

Answers were Sorted based on User's Feedback



What is anonymous class?..

Answer / niranjanravi

An Anonymous class is a class which is defined at run time
without having any name and it is instantiated and declared
at the same place.
Syntax:
new class classname(){}
new interface interfacename(){}
Keyword extends and implements are usedin this class.
It is always implicitly final.
It is never static or final.

Is This Answer Correct ?    3 Yes 0 No

What is anonymous class?..

Answer / rimjhim

it is a local inner class without any name.
it is instantiated at the time of declaration and must be
extended by a class or implemented by an interface.

new [class name](argument list){anonymous class body};

overridden functions can be declared in this calss and it
can have only one new method inside it.more than one can
not be called anywhere.
using dot operator we can call that new function.

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More Core Java Interview Questions

Is java 9 released?

0 Answers  


What are the standards to place package statement within a source code file?

1 Answers  


What are the super most classes for all the streams?

0 Answers  


What is parseint?

0 Answers  


write SQL command for table employee where print first name or last name start like "A" and who is working in domain(angular js,java,dotnet)

1 Answers  






Is singleton class immutable?

0 Answers  


What will happen to the exception object after exception handling?

0 Answers  


What are the advantages of defining packages in java?

0 Answers  


What are the operands of instanceof operator?

3 Answers  


What is the purpose of extern variable?

0 Answers  


What is the immediate superclass of the Dialog class?

2 Answers  


Is there a sort function in java?

0 Answers  


Categories