Explain Inner Classes in Java

Showing Answers 1 - 1 of 1 Answers

sbarik

  • Jan 30th, 2006
 

A class declared within another class/interface  is called as nested class.  There are four categories of nested classes.

1.Static memebr classes and interface..

2.non-static memeber classes and interfaces.

3.local classes.

4.anonymous classes.

The last 3 categories are collectively known as inner classes.. The differ from non -inner classes in one important  aspect --- 

that an instance of inner class may be associated with an instance of enclosing class.The insatnce of enclosing class is called the immidiate enclosing instance. An instance of inner class can acess the members of its immidiately enclosing instance by their simple name..

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions