• 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

class defined inside an interface

 
Ranch Hand
Posts: 60
  • 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 the class defined inside an interface

1.it is not possible in the java Laungage.
2.The class is always public.
3.The class is always static.
4.the class methods cannot call the methods declared in the interface.
5.the class methods can call only the static methods declared in the interface.

Answers : 2,3,4.

What is essential to be known about classes defined in an interface?
I know nothing about it.
Would be greatful if anyone helps me

Thanks in advance.
rajani
 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A class defined within an interface is no different than a top-level nested class. The only difference is that it is defined within an Interface, rather than a Class.

You can find a lot more information on these topics in the JLS, §9.5 Member Type Declarations and §8.1.2 Inner Classes and Enclosing Instances.

In addition, even though it's really about inner classes and not top-level nested classes, you can read this series in my blog:

Inner Classes
Inner Classes: Anonymous Classes
Inner Classes: Local Classes

The information is related.
 
reply
    Bookmark Topic Watch Topic
  • New Topic