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 the milky way in a void?

0 Answers  


What does n mean in java?

0 Answers  


What is xslt in java?

0 Answers  


What is hotjava?

0 Answers  


what do you meant by Runtime Polymorphism?

13 Answers   BVIMR, IBM, Persistent,


can you use the two main method in same class?how?

4 Answers   DELL, Geosoft, SparkTG,


How many arguments can a method have java?

0 Answers  


Can we declare register variable as global?

0 Answers  


Difference between error and exception

3 Answers   Nous, TCS,


What is serialization in java?

0 Answers  


What is tree in java?

0 Answers  


What are the methods to rectify ambiguities in the interfaces in JAVA?

0 Answers   CGI,


Categories