a)ABC should be an interface; something1 and something2 need not, for the expression to be legal.
b)ABC should be a class, something1 and something2 must be interfaces for the expression to be legal.
c)ABC, something1 and something2 must be interfaces for the expression to be legal
d)The above statement is always illegal in Java as multiple inheritance is not supported
Public ABC extends something1, something2 which of the following statements is/are true?
C) ABC, somthing1, something2 must be interface for the expression to be legal.
Though java doesn't supports multiple inheritence for class, an interface can extend as many interface as needed. You can try compiling. But there is also a reason behind it.
Java does not supports multiple inheritence because in diamond inheritence ( B and C extends A and D extends both B and C) it can cause ambiguity( as two copies of members of A would present in D).
This is not so for interface as there can't be ambiguity as all refer to same copy. So Java supports multiple inheritence for Inetrface
Reply:)The above statement is always illegal in Java as multiple inheritance is not supported
ABC needs to be a class. Something1, Something2 need to be interfaces and ABC should implement Something1 and Something2, not extend.
potential breakup song
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment