Recall & Review
beginner
What does it mean to implement multiple interfaces in Kotlin?
It means a class can follow the rules (methods and properties) of more than one interface, allowing it to have behaviors from all those interfaces.Click to reveal answer
beginner
How do you declare a class that implements two interfaces named A and B in Kotlin?Use a colon and separate the interfaces with commas, like: <br> <code>class MyClass : A, B { ... }</code>Click to reveal answer
intermediate
If two interfaces have a method with the same name, how does Kotlin handle it when a class implements both?Kotlin requires the class to override the method and explicitly specify which interface's method to use or provide its own implementation.Click to reveal answer
intermediate
What keyword is used in Kotlin to call a specific interface's method implementation inside an overriding method?
The keyword is
super with the interface name, like super<InterfaceName>.method().Click to reveal answer
beginner
Why is multiple interface implementation useful in Kotlin?
It allows a class to combine different behaviors from multiple sources without inheriting from multiple classes, which Kotlin does not support.Click to reveal answer
How do you declare a Kotlin class that implements interfaces A and B?
✗ Incorrect
In Kotlin, use a colon and separate interfaces with commas: class MyClass : A, B
What must you do if two interfaces have a method with the same name and your class implements both?
✗ Incorrect
Kotlin requires you to override the method and explicitly choose or provide your own implementation.
Which keyword lets you call a specific interface's method inside an overriding method?
✗ Incorrect
Use super with the interface name in angle brackets to call that interface's method.
Why can't Kotlin classes inherit from multiple classes?
✗ Incorrect
Kotlin supports only single class inheritance but allows multiple interfaces to be implemented.
What is the main benefit of implementing multiple interfaces?
✗ Incorrect
Multiple interfaces let a class have many behaviors without inheriting from multiple classes.
Explain how Kotlin handles method conflicts when a class implements multiple interfaces with the same method name.
Think about how you tell Kotlin which method to use.
You got /3 concepts.
Describe the syntax to implement multiple interfaces in a Kotlin class and why this is useful.
Focus on the declaration and the benefit.
You got /4 concepts.