wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes doubt : class defined inside an interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "doubt : class defined inside an interface" Watch "doubt : class defined inside an interface" New topic
Author

doubt : class defined inside an interface

Pankaja Shinde
Ranch Hand

Joined: Sep 15, 2006
Posts: 87
Mock Exam question

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.

Answer 2 3 4

I think answer should be 3 & 5.

Please explain me

Pankaj Shinde
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi Pankaja,

Interfaces can't have any methods declared as static. So innerclasses declared inside interface ,accessing static methods is not possible at all.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: doubt : class defined inside an interface
 
Similar Threads
class defined inside an interface
class inside interface
Doubt on Class defined inside an interface
Question on Interface
Interface??