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 a boolean expression in java?

0 Answers  


In the below example, what will be the output?

0 Answers  


What happens if we override only equals?

0 Answers  


Explain about OOPS concepts and fundamentals.

0 Answers   Syntel, Visa,


What are the different types of data structures in java?

0 Answers  






Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?

0 Answers  


How to do validation of the fields in any project ?

2 Answers  


What methods are used to get and set the text label displayed by a button object?

0 Answers  


Where import statement is used in a java program?

0 Answers  


What is the life cycle of Servlet?

3 Answers  


What is JVM ?

4 Answers   Phantom Technologies, TCS,


Why do we use regex?

0 Answers  


Categories