Can you extend more than one interface?

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a local class in java?

573


Can a method inside a interface be declared as final?

516


What do you understand by the bean persistent property?

547


Why is logger singleton?

555


In a program, initializing an array of 100 KB is throwing an out of memory exception while there is 100 MB of memory available. Why?

563






How many bits is size_t?

538


Can we call a non-static method from inside a static method?

551


Why is serialization required?

532


How to perform linear search in java?

560


If an application has multiple classes in it, is it okay to have a main method in more than one class?

530


Is 0 true or false?

507


What is high level language in computer?

526


what is object slice?

1566


Can an object be null?

539


How do you override a private method in java?

492