• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

K & B SCJP5 Page77

 
Ruwan Nanayakkara
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys
I need a clarification with the answeres given for the Self Test Question 1 on page 77.
It says that Answer 'A'. is incorrect because 'interface don't implement anything'.

Is there a rule saying if interface2 implements interface1, Interface2 should implement all the the methods in Interface1.

I couldn't find the page on chapter1 which explains this theory.

can someone explain this please?

/Ruwan.
 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please, post the question.
 
Ankit Garg
Sheriff
Posts: 9528
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ruwan, welcome to javaranch.

Ruwan Nanayakkara wrote:Is there a rule saying if interface2 implements interface1, Interface2 should implement all the the methods in Interface1.


I think you are not using the correct vocabulary. An interface extends another interface. Also an interface cannot implement methods. So if you are trying to say that if interface2 extends interface1 then any class implementing interface2 must give implementation of all the methods of interface1 and interface2 (otherwise that class will be abstract)...
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ruwan Nanayakkara wrote:Hi guys
I need a clarification with the answeres given for the Self Test Question 1 on page 77.
It says that Answer 'A'. is incorrect because 'interface don't implement anything'.

Is there a rule saying if interface2 implements interface1, Interface2 should implement all the the methods in Interface1.

I couldn't find the page on chapter1 which explains this theory.

can someone explain this please?

/Ruwan.


You can give this a try by writing 2-3 interfaces on your own and trying to implement them with a concrete class / abstract class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic