Type Here to Get Search Results !

Which of the following is true about interfaces in OOP?

0

 Which of the following is true about interfaces in OOP?

A) An interface can contain implementation of methods.
B) A class can implement multiple interfaces.
C) An interface cannot extend another interface.
D) Interfaces can have instance variables.

Answer: B) A class can implement multiple interfaces.

Explanation: An interface is a contract that defines a set of methods without implementing them. A class can implement multiple interfaces, allowing it to inherit abstract behaviors from multiple sources. Interfaces cannot have method implementations (unless they use default methods in some languages) or instance variables; they can only define method signatures.

Post a Comment

0 Comments