HomeCode HereJava object-oriented design quiz Java object-oriented design quiz Admin 1 min read Updated November 16, 2026 Nine questions on inheritance, polymorphism, interfaces, abstract classes and packages. Java Java object-oriented design quiz 9 questions, instant feedback Question 1 of 9 Which keyword inherits from a class? A implements B extends C inherits D super A class extends one superclass. It implements any number of interfaces. Question 2 of 9 What does @Override document? A That a method replaces an inherited one B That a method is final C That a method is abstract D That a method is static The annotation makes the compiler verify the signature matches something inherited, catching typos. Question 3 of 9 What is polymorphism in practice? A Many classes with the same name B Calling an overridden method through a parent type C Multiple constructors D Inheriting from several classes The variable's declared type decides what compiles; the object's actual class decides which implementation runs. Question 4 of 9 Can a class extend more than one class in Java? A Yes B No, only one C Only if abstract D Only with interfaces Java has single inheritance for classes to avoid the diamond problem. Interfaces provide the multiple-type behaviour. Question 5 of 9 What is an abstract method? A A method with no body that subclasses must implement B A private method C A static method D A method that returns null An abstract method declares a signature without a body, and the class containing it must be abstract. Question 6 of 9 When should you prefer an interface to an abstract class? A When you need shared field state B When you only need to promise behaviour C When you need a constructor D When the class must be final Interfaces describe capability without imposing a hierarchy, and a class can implement several. Question 7 of 9 What does super refer to? A The parent class's members B The current object C A static field D The package super calls the parent constructor or a parent method that the subclass has overridden. Question 8 of 9 What is the purpose of a package? A To group related classes and control access B To compile faster C To create objects D To replace inheritance Packages namespace classes and let package-private members be shared within the package only. Question 9 of 9 What does the Liskov substitution principle require? A A subclass must be usable wherever the parent is expected B Every class needs a parent C Methods must be final D Fields must be public If a subclass cannot honour the parent's contract, the inheritance is wrong and composition is usually better. Check my answers Try again Your answers stay in this browser. Nothing is sent to a server. More quizzes Java getting started quiz Coming soon Java control flow quiz 9 questions Java methods and objects quiz 9 questions All quizzes