File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

class defined inside an interface

 
Rajani Sudhakar
Ranch Hand
Posts: 60
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Corey McGlone
Ranch Hand
Posts: 3271
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic