File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Java Rule Round-up (#104) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Java Rule Round-up (#104)" Watch "Java Rule Round-up (#104)" New topic

Java Rule Round-up (#104)

Karin Paola Illuminate
Ranch Hand

Joined: Oct 18, 2002
Posts: 109
(#104) an inner class has free access to ALL member data of its enclosing (outer) class.
Answer: true
An inner class has a special relationship and can see even private member data of the outer class.
But, what about a static member class, which can only access static members? I answered false.

[ May 01, 2003: Message edited by: Karin Paola Illuminate ]

I not only use all the brains that I have, but all that I can borrow. [Laurence J. Peter]
Lawrence Chettiar
Ranch Hand

Joined: Apr 10, 2003
Posts: 62
Hi Karin,
If you see thru the JLS
"Inner classes may inherit static members that are not compile-time constants even though they may not declare them. Nested classes that are not inner classes may declare static members freely, in accordance with the usual rules of the Java programming language. Member interfaces (�8.5) are always implicitly static so they are never considered to be inner classes. "
Which clearly indicates that a static class is not a inner class. its a member class same as the interface defined within a class (member interface)

Hope this helped you.

SCJP 1.4 (86%)<br />SCMAD Beta (77%)<br />SCEA (part I:89%,partII:93%)<br />MCAD (cleared 70-315 & 70-320 [Score 980])
Karin Paola Illuminate
Ranch Hand

Joined: Oct 18, 2002
Posts: 109
Thanks. It is now clear to me that
Inner classes include non-static member classes, local classes and anonymous classes.

The definition of an inner class was not completely clear to me.
Inner Classes
I agree. Here's the link:
subject: Java Rule Round-up (#104)
It's not a secret anymore!