Examveda
Examveda

Which of the following is true?
1. A class can extend more than one class.
2. A class can extend only one class but many interfaces.
3. An interface can extend many interfaces.
4. An interface can implement many interfaces.
5. A class can extend one class and implement many interfaces.

A. 1 and 2

B. 2 and 4

C. 3 and 5

D. 3 and 4

E. 2 and 5

Answer: Option C


Join The Discussion

Comments ( 3 )

  1. Navyasri Erramsetty
    Navyasri Erramsetty :
    1 year ago

    Here only 2 and 5 are correct.. 3 is not correct because a class can never extend a interface it only implements any number of interfaces. And here 2 is correct because a class can extend only one class but implement many interfaces.

  2. Ummadi Veena
    Ummadi Veena :
    5 years ago

    3rd statement is correct because there is no parent class for interface. In case of a class , the super class is object class.
    Ex: class A extends Interface1, Interface2, Interface3..... Hence multiple interfaces can be inherited.

  3. Niroshan Kumarasamy
    Niroshan Kumarasamy :
    6 years ago

    can you give simple example of An interface can extend many interfaces?

Related Questions on Inheritence

Which is true?

A. "X extends Y" is correct if and only if X is a class and Y is an interface

B. "X extends Y" is correct if and only if X is an interface and Y is a class

C. "X extends Y" is correct if X and Y are either both classes or both interfaces

D. "X extends Y" is correct for all combinations of X and Y being classes and/or interfaces