1.

Can we implement multiple interfaces in a single Java class?

Answer»

Yes, it is allowed to implement multiple interfaces in a single class. In Java, multiple INHERITANCES is achieved by implementing multiple interfaces into the class. While implementing, each interface NAME is separated by using a comma(,) operator.
Syntax:

public class ClassName IMPLEMENTS Interface1, Interface2,..., InterfaceN{ //Code }

EXAMPLE:

public class InterviewBit implements X, Y{ //Code}

Here, X and Y are the interfaces implemented by the class InterviewBit.



Discussion

No Comment Found