File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes nested classes 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 "nested classes" Watch "nested classes" New topic
Author

nested classes

meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305


MemberTest.java:17: error: cannot find symbol
System.out.println(Nested.j);
^
symbol: variable j
location: class Nested
1 error

nested classe can have static members of enclosing class, then whats problem here ?


My one regret in life is that I am not someone else.
- Woody Allen
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10519
    
    9


Your Nested class does not define any variable called 'j'


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305

Maneesh Godbole wrote:
Your Nested class does not define any variable called 'j'


Nested class has access of private static member j of enclosing class , then why it can't be (Nested.j) ?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10519
    
    9

meeta gaur wrote:
Nested class has access of private static member j of enclosing class , then why it can't be (Nested.j) ?

Because the syntax Nested.j means 'j' is defined in the Nested class
meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305

Thank you
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: nested classes