• 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
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

doubt - innerclasses & interface

 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,
Which of the following statements is true?

a) An interface can contain a nested top-level inner class.

b) An interface can contain a member inner class.

c) A member inner class can implement an interface.

d) A static method can contain a local class.

e) A static method can contain a nested top-level class.

I didn't understand options a& e
can you please give me some sample code to represent the options a & e.
Thanx & Regards
Naresh
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

An interface can contain only nested top level class that means static member class.

So option 'A' is wrong. If they mention it as nested top level class instead of nested top level inner class then it would be correct.

Option 'E' is wrong because a static method can contain a local class or anonymous class not a nested top level class.

Please correct me if i'm wrong.

Regards,
Surekha.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic