• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

accessible variable in inner class

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
which bvariable can an inner class access from the class which encapsulates it
1 all static variables
2 all finla variables
3 all insrtance variable
4 all instance final variable
5 only finla static variable a

what does the inner class means here static or non static also ther can
be many possibilities it can be within a static outer class or non static outer class
what shuld be assumed in such Questions
 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
which bvariable can an inner class access from the class which encapsulates it
1 all static variables
2 all finla variables
3 all insrtance variable
4 all instance final variable
5 only finla static variable a

what does the inner class means here static or non static also ther can
be many possibilities it can be within a static outer class or non static outer class
what shuld be assumed in such Questions [/B]
if nothing is mentioned assume it to be a non-static inner class

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can checj the inner class document at http://www.geocities.com/korayguclu
This document describes inner classes in detail.
 
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nishesh,
You can safely assume the question to be non-static inner class
and in that case the answer is : choice (1),(2),(3) .
I am not clear about the choice (4)
You can verify the answer with the following code.

On the other hand if the question is static inner then the rules of static modifier applies, viz., the inner classs CAN access ONLY, the static variables and final static variables ONLY.
You can refer the following code.

Hope this clears your doubt.
Ravindra Mohan.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic