Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Can you extend more than one interface?

Answers were Sorted based on User's Feedback



Can you extend more than one interface?..

Answer / ranganathkini

An interface can extend 1 or more interfaces. Though this
kind of extension mechanism is limited for classes extending
classes. It is not true for interfaces. Please observe
Interface3 in the following example:

interface Interface1 {
void method1();
}

interface Interface2 {
void method2();
}

interface Interface3 extends Interface1, Interface2 {
void method3();
}

public class InterfaceTest implements Interface3 {
public void method1() {

}

public void method2() {

}

public void method3() {

}

public static void main( String[] args ) {

}
}

Is This Answer Correct ?    67 Yes 3 No

Can you extend more than one interface?..

Answer / vijayakumar chinnasamy

There is no limit for interface extends. One interface can
extends any number of interfaces.

interface inter1 { }

interface inter2 { }

interface interN { }

interface ExtendsInterface extends inter1,inter2,... , interN {

}

Is This Answer Correct ?    31 Yes 4 No

Can you extend more than one interface?..

Answer / ganesh

we can extends one or more interfaces by using an interface.
i.e)Multiple inheritance is available in case of interfaces.

we can't extends an interface by using a class,but we able
to implemented.

Sytax:

1)interface interfacename1 extends interface2 //true
2)interface interfacename1 extends
interface2,interfacename2,..............interfacenamen //true

Is This Answer Correct ?    16 Yes 5 No

Can you extend more than one interface?..

Answer / swapnil bhosale

hey you all my friends ,we can not extends interface ,we can only implements it,is it true we can implement more than one
interface ,but can not extends it (not single not more)

run the following code so you could understand difference between extends and implements keyword

//code using extends keyword
import java.io.*;
interface A{}
interface X{}
interface Y{}
class ExDemo extends A,X,Y
{
public static void main(String arg[])
{
int a;
System.out.println("hey it works");
}
}

//code using implements keyword
import java.io.*;
interface A{}
interface X{}
interface Y{}
class ExDemo implements A,X,Y
{
public static void main(String arg[])
{
int a;
System.out.println("hey it works");

}
}

Is This Answer Correct ?    3 Yes 0 No

Can you extend more than one interface?..

Answer / 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

Can you extend more than one interface?..

Answer / rajeshbonepalli

An interface can extend other interfaces, just as a class
can extend or subclass another class. However, whereas a
class can extend only one other class, an interface can
extend any number of interfaces. The interface declaration
includes a comma-separated list of all the interfaces that
it extends.

interface Sameinterface1 { }

interface Sameinterface2 { }

interface Sameinterface3 { }
....

...
interface SameinterfaceN { }

interface Sameinterface4 extends
Sameinterface1 ,Sameinterface2 ,...Sameinterface3 ,
SameinterfaceN {

}

Is This Answer Correct ?    3 Yes 1 No

Can you extend more than one interface?..

Answer / jag

s we can

Is This Answer Correct ?    2 Yes 3 No

Can you extend more than one interface?..

Answer / ashokmail.java@gmail.com

interfaces are implementing not extends. We can implements
more than one interfaces

Is This Answer Correct ?    18 Yes 35 No

Can you extend more than one interface?..

Answer / a srinivas rao

we cannot extended INTERFACES,only can implement
INTERFACES.java allows you to implement more than one
INTERFACE.

Is This Answer Correct ?    8 Yes 38 No

Post New Answer

More Core Java Interview Questions

Why java applets are more useful for intranets as compared to internet?

0 Answers  


Explain reverse a linked list iterative solution in java?

0 Answers  


What is a package in java? List down various advantages of packages.

0 Answers  


What are the fileinputstream and fileoutputstream?

0 Answers  


What’s a deadlock?

0 Answers  


What is the difference between hashmap and hashtable? What is an interface?

0 Answers  


What are the various access specifiers in java?

0 Answers  


What is a boolean field?

0 Answers  


Hey buddy.. can you please tell me about the use of marker interface? And is there any link between marker interface and factory methods? Thanks in advance.

2 Answers  


What are the legal parameters?

0 Answers  


What are uses of Hash Code?

2 Answers   Cognizant,


how to use this key word in java programming?

7 Answers  


Categories