• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Inner & Enclosing classes

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Consider following code
class A
{
static class B
{
class C
{
}
}
}
Which of these statements r true ?
1 A is an enclosing class of C
2 B is an enclosing class of C
3 C is an enclosing class of C
4 A is an enclosing class of B
5 C is direct inner class of B
6 C is direct inner class of A
I feel 1,6 are the only correct answer!!
Is the ans corrct.
 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Yogesh,
1,2,4 are definitely correct. But the word 'direct inner class' bother's me. I never heard this word. Someone please clarify.
I don't think you will be tested on this concept. However, IS-A and HAS-A are very important for the exam.
Cheers
-Suresh
 
Yogesh Chhawasaria
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I doubt 2 & 4 aint correct ans.
B is a static class so belongs to a static context.
Hence B is not an inner class by definition.
Plz correct me if i am wrong !!
 
reply
    Bookmark Topic Watch Topic
  • New Topic