what is inner class?

Answer Posted / harish

Inner classes nest within other classes. A normal class is
a direct member of a package, a top-level class. Inner
classes, which became available with Java 1.1, come in four
flavors:
? Static member classes
? Member classes
? Local classes
? Anonymous classes
Let's take a quick look at each in turn.
Briefly, a static member class is a static member of a
class. Like any other static method, a static member class
has access to all static methods of the parent, or top-
level, class.
Like a static member class, a member class is also defined
as a member of a class. Unlike the static variety, the
member class is instance specific and has access to any and
all methods and members, even the parent's this reference.
Local classes are declared within a block of code and are
visible only within that block, just as any other method
variable.
Finally, an anonymous class is a local class that has no
name.

Is This Answer Correct ?    6 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is cout buffered?

682


When is the finalize() called? What is the purpose of finalization?

577


What are the different types of data structures in java?

484


What is implicit object in java?

543


Is break statement can be used as labels in java?

497






What do you mean by an object in java?

624


What are advantages of exception handling in java?

576


What is the purpose of assert keyword used in jdk1.4.x?

556


What is e java?

554


Explain about data types?

571


How many functional interfaces does java 8 have?

598


What are memory tables?

603


What is ternary operator?

561


What is the destroy method?

582


Can a constructor call the constructor of parent class?

532