What is the use of anonymous inner classes ?

Answer Posted / sumit bansal

Anonymous class exist till the method or block (In which it
is defined) runs. After that it vanishes so it help to use
the memory efficiently.

in your code if you want a particular class once and that
is also in the method/block use anonymous class.

it is the best of my knowledge. if you know more please
reply me.

Is This Answer Correct ?    20 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the size of int in 64-bit jvm?

531


What is "this" keyword in java? Explain

636


How many ways can an argument be passed to a subroutine and explain them?

554


List the interfaces which extends collection interface?

513


What is static keyword in java?

526






What is the use of math abs in java?

525


What is sizeof in java?

527


What happens if constructor is private?

529


Explain abstract class in java?

535


Using callable statement how can you pass out parameters, explain with example?

559


Is it possible for yielded thread to get chance for its execution again ?

523


Can we override the overloaded method?

537


What is palindrome in java?

531


does java support pointers?

541


How many bits is a word?

542