• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Inner classes

 
Ranch Hand
Posts: 321
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is found out in the IBM mock exam can someone help me out to find which all are true ?
1) An interface can contain a nested top-level inner class
2)A member inner class can implement an interface.
3)A static method can contain a local class
4)A static method can contain a nested top-level class
5)An interface can contain a member inner class.
In my opinion 2,3,4,5 are correct, can anyone throw some light?
 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Regarding the above question,
What exactly do you mean by a top-level inner class? the phrase seems quite contradictory

------------------
Regards,
Shree
[This message has been edited by shree vijay (edited December 14, 2000).]
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What he means is that if a inner class is defined as being static is becomes a top-level [inner] class. This only applies to those inner classes defined as static.
Answers to questions : 1, 2, 3, 5
This compiles fine for answer 1:-

This compiles fine for answer 3:-

This compiles fine for answer 5:-

David.
[This message has been edited by David Harrigan (edited December 14, 2000).]
 
Wait for it ... wait .... wait .... NOW! Pafiffle! A perfect tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic