• 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 Classes.

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which of the following are TRUE about inner class? Mark
I found this question in one of the books. Can anyone pls calrify my doubts about this query.



Answer: BE
My Answer: CE
 
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Neha!

Answers B and E are correct.

An anonymous class can extend a class or implement an interface at a time not both.

An inner class can be instantiated outside of a class provided it is not private but only using the reference of the outer class. That is you must create an instance of the outer class to instantiate the inner class. This is the case of (non static inner class). To instantiate a static inner class you dont require to first instantiate the outer class. You do like this:

Outer.inner in = new Outer.inner(); //inner is static

Regards,
CMBHATT
 
reply
    Bookmark Topic Watch Topic
  • New Topic