File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interface inheritance 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 "Interface inheritance" Watch "Interface inheritance" New topic

Interface inheritance

Gaurav Pavan Kumar Jain
Ranch Hand

Joined: Mar 19, 2007
Posts: 168
. public interface A {
2. String DEFAULT_GREETING = �Hello World�;
3. public void method1();
4. }
A programmer wants to create an interface called B that has A as its
parent. Which interface declaration is correct?
A. public interface B extends A { }
B. public interface B implements A {}
C. public interface B instanceOf A {}
D. public interface B inheritsFrom A { }

Answer is B but i think it should be A
vijaya bharath
Ranch Hand

Joined: Jun 10, 2005
Posts: 66

The answer for this cannot be B. Interface implements interface is never legal.
keyword itself says that the class which is implementing the interface will give the implementtion for all the methods in the interface(unless the class is a abstract class).

Regards,<br />Vijaya Bharath.<br />SCJP1.4 <br />SCWCD5.0
rex tony
Ranch Hand

Joined: Aug 29, 2007
Posts: 159
Gaurav Pavan Kumar Jain
The answer is Only "A"
<Interface> extends <interface>
<class> implements <interface>
you've to see the JSL 9.1.1
B is illegal
I agree. Here's the link:
subject: Interface inheritance
It's not a secret anymore!