Thursday, November 8, 2007

Topic --Inner Classes

Following are important points to be noted about Inner Classes :-

1. An Inner class defined local to a block should not be static

2. An inner class can extend any class.

3. An inner class cannot declare static variables unless the inner class is itself static.

4. An inner class can be a sub class of the outer class.

5. An inner class cannot have the same name as its outer class.

6. An anonymous inner class is always assumed to directly extend Object. // false

7. An anonymous inner class can implement more than one interface using a list separated by commas //false

8. Methods of non-static inner classes can directly access any member of any enclosing class. Static and non-static inner classes cab have any accessibility

9. Non-static inner classes cannot define any static variables.

10. Multiple objects of inner classes can be associated with an object of an enclosing class.

11. If a class is derived from a base class , and the derived class is also an inner class in another class. If the derived class and the container class contain the same variable, the conflict occurs. In that the inherited member shadows the other.

12. Local class can access members defined within the class.

Please post all your queries about inner clases here.

Search Amazon for Best Books on Java J2EE


blogarama - the blog directory

Search your favourite topics