Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inner classe

 
Nisheeth Kaushal
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Can anyone provide me with the list of modifier that variables of a class and is accessible to static inner classes and inner classes.
Is it true that static inner class can only access fianl variables of the outer class.
Nisheeth.
 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nisheeth Kaushal:
Hi all,
Can anyone provide me with the list of modifier that variables of a class and is accessible to static inner classes and inner classes.
Is it true that static inner class can only access fianl variables of the outer class.
Nisheeth.


1. non static inner classes can access all(private, protected, public) members of outer class.
2. static classes can access all static members of outer classes.(can not access non static members).
3. inner classes in side the member method can access all members of outer class and only final arguments of the method.
CMIW (correct me if wrong)

------------------
Regards
Ravish
 
Gurpreet Sachdeva
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Kaushal,
I have created a chart of all the variables that can be used with inner classes and it is available here.
Regards
Gurpreet Sachdeva
For Mock Exams, FAQ and some useful information about Bitshift operator, inner classes, garbage collection,etc please visit: http://www.go4java.20m.com
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic