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

What is another word for methodology?

0 Answers  


Explain importance of throws keyword in java?

0 Answers  


Why are the methods of the Math class are static?

1 Answers  


How is the marker interface used in Java?

0 Answers   BirlaSoft,


what is the use of declaring constructor as private?

5 Answers   Cyient, IVY Technologies, Sai Softech, Virtusa,






Are variables stored in ram?

0 Answers  


Can Exception handling we can handle multiple catch blocks?

0 Answers   PUCIT,


String Reverse in Java...!

5 Answers  


How is hashset defined in java?

0 Answers  


How we create object in copy constructor?

0 Answers   HCL,


Will the jvm load the package twice at runtime?

0 Answers  


Explain wrapper classes in java?

0 Answers  


Categories