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 doubt from K&B 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 doubt from K&B " Watch "Interface doubt from K&B " New topic

Interface doubt from K&B

dhwani mathur
Ranch Hand

Joined: May 08, 2007
Posts: 621
hi all!!
i have a doubt from K&B book,i read the topic Interface it is given that an interface can extend another interface.
My question is that If Interface AB extends Interface AC than

1)if any class say A implements interface AB is it compulsory for the class A to write the defination of methods defined in interface AC bcoz AC interface extends Interface AB?or it can just implement methods of interface AB?

2)for extending interface is that we just need to use "extends"?
And one more question is can class A implement only the "interface AC"...and not interface AB?

please if anyone could clear my doubt,it will be kinda of you.Thanks in advance
Nik Arora
Ranch Hand

Joined: Apr 26, 2007
Posts: 652
Hi Dhwani,
If interface AB extends AC as you have mentioned then if class A implents AB then both the interface methods has to be defined in class A.

If you want to implement only AC interface you can do that and define only the methods in AC interface.

There is only keyword extends if one interface wants to extend another interface.

dhwani mathur
Ranch Hand

Joined: May 08, 2007
Posts: 621
hi nik!!
Thank you for your explanation!!i got my answer!!
I agree. Here's the link:
subject: Interface doubt from K&B
It's not a secret anymore!