Search the courses, subjects, tracks, games and features, or jump straight to a page.
4 cards from this section. Quick, good the night before a test.
What is an interface in Java?
Think of it as a contract.
Can a class implement multiple interfaces?
Recall the definition of multiple inheritance.
What is an interface in Java?
Consider what ‘abstract’ means.
Is it possible for a class to implement more than one interface?
Think about how different functionalities might be integrated.
Imagine you're creating a software application for an online store. Define an interface called 'Purchasable' with a method 'purchase()'. Implement this interface in classes 'Book', 'Electronics', and 'Clothing'. Describe how each class might behave differently when 'purchase()' is called.
Think about the different purchasing processes for various item types.
You are asked to improve the maintainability of an application by introducing interfaces. Current classes have tightly-bound dependencies. Explain how you would use interfaces to achieve this goal.
Consider how you can decouple components in your system.
6 more questions in this section. Enroll free to practise them all.
Enroll free