Can somebody please tell me what are the differences between an inner class and an outer class???
I found out that inner classes cannot have static declarations. Are there any other significant differences???
Thanks in advance
See Getting in touch with your inner class, and let us know if you have further questions.
I recall private data from the outer class is not available within an inner class but this may not be correct.
All data and methods of outer class are availble to inner class.
The inner class is not known to other classes. Good way to hide stuff. Outer class knows about it but no other.
[ May 03, 2007: Message edited by: Sidd Kulk ]
There are two additional types of inner classes. You can declare an inner class within the body of a method. Such a class is known as a local inner class. You can also declare an inner class within the body of a method without naming it. These classes are known as anonymous inner classes.
Originally posted by David McCombs:
...if the inner class is static.
This raises the old terminology question. A nested class can be static, but according to the JLS...
An inner class is a nested class that is not explicitly or implicitly declared static... Inner classes may not declare static members, unless they are compile-time constant fields..."
(Ref: 8.1.3 Inner Classes and Enclosing Instances.)
[ May 04, 2007: Message edited by: marc weber ]