• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

nested classes

 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 ?
 
Maneesh Godbole
Saloon Keeper
Posts: 11173
14
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Your Nested class does not define any variable called 'j'
 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11173
14
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic