aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes class defined inside an interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "class defined inside an interface" Watch "class defined inside an interface" New topic
Author

class defined inside an interface

Rajani Sudhakar
Ranch Hand

Joined: Apr 28, 2004
Posts: 60
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

Joined: Dec 20, 2001
Posts: 3271
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.


SCJP Tipline, etc.
 
Don't get me started about those stupid light bulbs.
 
subject: class defined inside an interface