Dear all, i have some problem with inner class 1. What is the meaning of inner class and nested class ? 2. Can you explain to me what the differences between inner class and nested class ? thanks daniel
Fisher, Your question is really broad. Can you narrow it a little bit? Also, this question has probably been discussed at length in this form. Therefore a search might return and load of valuable info.
Hope This Helps
Joined: Sep 14, 2001
Hi all, actually I have a question like this.. Which of the following statements are true? a. Non-static inner classes must have either defaul or public accessibility b. Non-static inner classes cannot contain static members c. Methods in all nested classes can be declared static d. all nested classes can be declared static e. A static inner class can declare contain a non-static inner class the answer is e.. Why is option b wrong? thanks daniel
Jamal, you are not totally correct. see JLS inner classes. basically inner classes: are classes that are not decalred 'static'. nested classes: are classes that are static. it doesn't matter if the class is inside a method or not. ok Mr Hasan( ov )
JLS: An inner class is a nested class that is not explicitly or implicitly declared static.
So NESTED CLASSES can be divided in (not-static) INNER CLASSES (local, anonymous and non-static members) and STATIC MEMBER CLASSES. Sound like nitpicking but the confusing is all around about this (even in some books!). Erik Dark [ March 14, 2002: Message edited by: Erik Dark ]
Joined: Aug 26, 2001
Sound like nitpicking Not at all! Accuracy and precise terminology is of paramount importance.