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 importance of static variable?

1 Answers  


What is the difference between public, private, protected, and friend access?

1 Answers   Amazon,


How to validate the request (Eg:user name and password) in session(http session)? not in LDAP server ?

1 Answers   Saksoft,


What is OOPs & Why?

3 Answers  


What is primitive array?

1 Answers  


What is the purpose of using java.lang.class class?

1 Answers  


What is length in java?

1 Answers  


Is there any limitation of using inheritance?

1 Answers  


Write down program for following scenario. Use java coding standard. You have array list with some words in it..we will call it as dictionary….and you have a arbitrary string containing some chars in it. You have to go through each word of dictionary and find out if that word can be constructed with the help of chars from arbitrary string given. If you find the word print it else print none.

1 Answers   Rolta,


What do you mean by composition in java?

1 Answers  


What is the purpose of using javap?

1 Answers  


Why char array is preferred over string for storing password?

1 Answers  


Categories