• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Interface doubt from K&B

 
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 652
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Regards
Nik
 
dhwani mathur
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi nik!!
Thank you for your explanation!!i got my answer!!
 
It runs on an internal combustion engine. This ad does not:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic