What are inner and anonymous class?

Answer Posted / harika.thota001@gmail.com

Inner Class in java so called nested class is nothing but a class that is being defined inside another class. Inner classes are beneficial in two scenarios i.e. access control and naming control. Although these benefits can be acquired using java packages.

anonymous class is an inner class that does not have a name at all. And whose instance is being created at the time of its creation.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is dynamic binding(late binding)?

780


Define inheritance with reference to java.

776


Define an enumeration?

791


What are the 6 functions?

703


Can you call a method in a method?

748


Can java object be locked down for exclusive use by a given thread?

761


What is thread pool in java with example?

725


How do you convert boolean to boolean?

768


How do you generate random numbers in java?

727


What is a line break?

782


Is arraylist ordered in java?

765


What is nextint java?

734


What is the right data type to represent a price in java?

735


What are the advantages of functions?

700


Why multiple inheritance is not supported by java?

707