Can you extend more than one interface?

Answer Posted / manish kushwaha

Hi All,
As we all know java is not complete OOps language the reason
behind this is java does not support multiple inheritance,
to avoid this draw back of java sun introduce interface
alomg with few new concept.

So 110% sure that we can implements and we can extends as
well more than one interface.

Scenarios:
1) in term of subclass

interface i1{
void mi1();
}
interface i2{
void mi2();
}

now

Case 1:

public class MultipleImplements implements i1,i2{
// now here we need t implement all methods available in i1
and i2 (restricted)

public void mi1(){
System.out.println("Interface i1 mthod");
}
public void mi2(){
System.out.println("Interface i2 mthod");
}
}

Case 2:

interface i3 extends i1,i2{
// here use can define more method and you can not over ride
i1 and i2 method because you can not method body in interface so
String mi3();
}

Conclusion: 110% you can extend and implement more than one
interface

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an object's lock and which object's have locks in java programming?

559


Why are arrays useful in java?

536


Can we force garbage collector to run ?

563


Tell some latest versions in JAVA related areas?

548


Can private members of a base class are inheritable justify?

476






Does string isempty check for null?

556


Is empty in java?

575


Why singleton pattern is better than creating singleton class with static instance?

525


Does chrome use java?

508


Does constructor creates the object ?

572


Is an empty arraylist null?

587


What are the advantages of passing this into a method instead of the current class object itself?

1157


what is recursion in java

589


What does opcode mean?

522


What is not object oriented programming?

495