Class B in the first case need to provide the implementation of methods present in I interface. There is no such restriction of the second B class.
Joined: Jun 23, 2011
But in example 1 as Class A has already implemented the methods of I then B need not provide an implementation as they will be inherited from A
Correct me if I am wrong!!!
Joined: Aug 24, 2010
I am not able to understand your doubt. Code is also vague.
1) Let us assume that in first example class A has implemented all the methods of the interface I. Now since B is subclass of A, do we really need to implement interface I again ? Regarding your doubt in case class A has implemented all the methods of I, we dont need to implement them in B.
2) In the case when Class A has implemented only one method of interface I , we need to define class A as abstract. If class B extends A and implement I , class B can be concrete only if we define second method of I.
Because class A implements interface I and class B extends class A, class B already implicitly implements interface I. You can leave out the implements clause. In fact, Eclipse can warn you about unnecessary implements clauses.