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

How do you define a singleton class?

507


Can you run java program without main method?

543


What is the use of bufferedreader?

528


Can we create an object of private class?

545


What is style and indentation?

550






What is a short in java?

496


Objects or references which of them gets garbage collected?

530


What is boolean flag in java?

574


What are white spaces in java?

525


How do you declare an empty string?

615


How the interruptible method gets implemented?

554


What is data and its types?

571


how do I create a runnable with inheritance? : Java thread

505


How do you start a new line in java?

516


Define how can we find the actual size of an object on the heap?

650