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 the frontend and backedn in Java?

3 Answers   TCS,


which methods consisting of the serilizable interface?

3 Answers  


Different types of modifiers?

8 Answers   RoboCom,


Is linked list a linear or non-linear data structure?

0 Answers   Akamai Technologies,


Explain the difference between private, public, package and protected in java?

0 Answers  


what is j2se

3 Answers  


Why can't we override private static methods?

0 Answers  


What is listnode in java?

0 Answers  


Why ArrayList class is not a synchronized class and why it is not a thread safe class? explain

1 Answers  


What are operators and its types?

0 Answers  


Why is java called the platform independent programming language?

0 Answers  


List the features of java programming language.

0 Answers  


Categories