Java inheritance and polymorphism form the bedrock of Object-Oriented Programming (OOP), enabling code reuse and flexible runtime behavior. Inheritance allows a subclass to acquire properties and methods of a superclass using the extends keyword, while polymorphism empowers objects to be treated as instances of their parent classes. Through features like method overriding and dynamic method dispatch, Java resolves method calls at runtime rather than compile-time. Mastering these core concepts is vital for designing scalable software architectures and clearing technical certification exams.
Java Inheritance and Polymorphism MCQs
1 min read
Correct Answer: c) extends
Explanation:
The extends keyword is used in Java to indicate that a class is derived from another class.
Correct Answer: b) java.lang.Object
Explanation:
java.lang.Object is the topmost class in the Java class hierarchy. Every class directly or indirectly inherits from it.
Correct Answer: d) Multiple inheritance
Explanation:
Java does not support multiple inheritance of classes to avoid the diamond problem. It is achieved through interfaces.
Correct Answer: b) Code Reusability
Explanation:
Inheritance allows a subclass to reuse the properties and methods of its superclass, reducing code duplication.
Correct Answer: c) super
Explanation:
The super keyword is a reference variable used to refer to the immediate parent class object.
Correct Answer: b) No, constructors are not inherited
Explanation:
Constructors are not inherited by subclasses. However, the superclass constructor is invoked using super().
Correct Answer: b) It cannot be subclassed
Explanation:
A final class cannot be extended by any other class. It prevents inheritance.
Correct Answer: b) Defining a method in a subclass with the same signature as a method in its superclass
Explanation:
Method overriding occurs when a subclass provides a specific implementation of a method that is already provided by its parent class.
Correct Answer: b) Method overriding
Explanation:
Run-time polymorphism (Dynamic Method Dispatch) is achieved in Java through method overriding.
Correct Answer: a) @Override
Explanation:
The @Override annotation tells the compiler that the method is meant to override a method declared in a superclass.
Correct Answer: b) Method overloading
Explanation:
Method overloading is a form of compile-time (static) polymorphism because the compiler decides which method to bind based on the arguments.
Correct Answer: c) No, declaring a static method with the same signature in a subclass hides the superclass method
Explanation:
Static methods are bound to the class, not the object. Declaring a static method with the same signature in a subclass is known as Method Hiding, not overriding.
Correct Answer: b) It must not be more restrictive than the overridden method
Explanation:
An overriding method can increase the visibility (e.g., protected to public) but cannot decrease it (e.g., public to protected).
Correct Answer: c) final methods
Explanation:
A method declared with the final keyword cannot be overridden by subclasses.
Correct Answer: b) No
Explanation:
Private methods are not visible to subclasses and therefore cannot be overridden.
Correct Answer: c) Allowing an overriding method to return a subclass of the return type declared in the overridden method
Explanation:
Since Java 5, it is possible to override a method and change its return type to a subclass of the original return type.
Correct Answer: c) As the very first statement in the constructor
Explanation:
The call to super() must always be the first statement executed inside a subclass constructor.
Correct Answer: c) The compiler automatically inserts a call to the no-argument super() constructor
Explanation:
If no constructor is called explicitly using this() or super(), the compiler implicitly inserts a call to the default super() constructor.
Correct Answer: c) No, they cannot both be the first statement
Explanation:
Both this() and super() must be the first statement in a constructor, so they cannot be used simultaneously in the same constructor.
Correct Answer: a) instanceof
Explanation:
The instanceof operator is used to test whether an object is an instance of a specified type.
Correct Answer: a) Casting a subclass reference to a superclass reference
Explanation:
Upcasting is casting a reference of a subclass to a superclass type. It happens implicitly.
Correct Answer: b) Casting a superclass reference to a subclass reference
Explanation:
Downcasting is manually casting a superclass reference back to a subclass reference. It must be done explicitly.
Correct Answer: a) ClassCastException
Explanation:
If a superclass reference does not actually point to the specified subclass object, downcasting throws a ClassCastException at runtime.
Correct Answer: c) No, a class implements interfaces, it does not extend them
Explanation:
A class implements an interface. An interface extends another interface.
Correct Answer: a) Yes
Explanation:
While classes cannot extend multiple classes, an interface is permitted to extend multiple other interfaces.
Correct Answer: b) Method name and parameters
Explanation:
Overloading occurs when methods share the same name but have different parameter lists.
Correct Answer: b) No
Explanation:
Methods cannot be overloaded based solely on their return type. The parameter list must be different to prevent compilation errors.
Correct Answer: c) The actual object type being referred to
Explanation:
In dynamic method dispatch, the overriding method is chosen based on the actual object created at run-time, not the reference type.
Correct Answer: c) Aggregation/Composition
Explanation:
The has-a relationship refers to aggregation or composition, where one class uses an instance of another class as a member field.
Correct Answer: c) Inheritance
Explanation:
The is-a relationship denotes inheritance.
Correct Answer: b) final
Explanation:
The final keyword applied to a variable makes it a constant, preventing further modification.
Correct Answer: a) Yes
Explanation:
Abstract classes can have constructors. They are called when a concrete subclass is instantiated.
Correct Answer: b) No, abstract classes cannot be instantiated
Explanation:
Abstract classes are meant to be subclassed; therefore, direct instantiation using new is prohibited.
Correct Answer: c) abstract
Explanation:
If any method in a class is declared abstract, the entire class must also be declared abstract.
Correct Answer: b) No
Explanation:
A final class cannot be extended, and an abstract method requires a subclass to provide implementation. Thus, they are contradictory.
Correct Answer: b) Using the super keyword
Explanation:
The super keyword can be used to reference shadowed instance variables from the superclass.
Correct Answer: b) No, they are not inherited
Explanation:
Private fields and methods are restricted to the class they are declared in and are not inherited by subclasses.
Correct Answer: b) Yes, but the JVM will only call the standard main(String[] args)
Explanation:
The main method can be overloaded just like any other method, but the JVM strictly looks for public static void main(String[] args) to start execution.
Correct Answer: b) this()
Explanation:
The this() keyword is used to invoke one constructor from another within the same class.
Correct Answer: c) Many forms
Explanation:
The word polymorphism comes from the Greek words poly (many) and morphs (forms).
Correct Answer: c) They provide a default implementation that implementing classes can use or override
Explanation:
Since Java 8, interfaces can have default methods with bodies, which can be used as-is or overridden by the implementing classes.
Correct Answer: b) The compiler throws a compilation error unless the class overrides the method
Explanation:
To resolve the ambiguity, the implementing class must override the conflicting method and optionally call a specific interface's default method.
Correct Answer: b) No, variables can only be hidden, not overridden
Explanation:
Java supports method overriding, but data members (variables) are not polymorphic. Declaring a variable with the same name in a subclass simply hides the superclass variable.
Correct Answer: b) The superclass variable is accessed
Explanation:
Since variables do not participate in polymorphism, an upcasted reference will always access the variable defined in the reference type's class.
Correct Answer: c) The process of calling one constructor from another constructor within the same class or superclass
Explanation:
Constructor chaining is achieved using this() and super() to reuse initialization logic.
Correct Answer: b) No
Explanation:
Interfaces are meant to be implemented by classes. Marking an interface final would prevent implementation, resulting in a compilation error.
Correct Answer: c) Constructors are called in the order A, B, C
Explanation:
In Java, constructors are executed from the top of the inheritance hierarchy down to the bottom (Parent -> Child).
Correct Answer: b) Yes, and it can choose to leave some or all methods abstract
Explanation:
An abstract class can implement an interface without being forced to provide method implementations. The concrete subclasses will bear that responsibility.
Correct Answer: c) Class C
Explanation:
C is the superclass of B, and B is the superclass of A. Thus, C is at the top of this specific hierarchy.
Correct Answer: c) They are accessible in the same package and by subclasses in other packages
Explanation:
The protected access modifier allows visibility within the same package and to subclasses regardless of the package.
Correct Answer: a) It must throw the exact same exception or a subclass of it, or not throw any checked exception
Explanation:
An overriding method cannot throw new or broader checked exceptions compared to the overridden method.
Correct Answer: b) No, it cannot throw any checked exception
Explanation:
If the parent method throws no checked exceptions, the overriding method is strictly forbidden from throwing new checked exceptions, though unchecked exceptions are allowed.
Correct Answer: c) It results in a compile-time error
Explanation:
A final method cannot be overridden or hidden. Any attempt to declare a method with the same signature in the subclass will fail to compile.
Correct Answer: b) It must be initialized in all constructors
Explanation:
A blank final variable is not initialized during declaration. It must be explicitly initialized in all constructors of the class.
Correct Answer: c) Only methods defined in Parent (or inherited by it)
Explanation:
The compiler restricts method access based on the reference type (Parent). To call Child-specific methods, a downcast is required.
Correct Answer: b) No
Explanation:
An interface can only extend other interfaces. It cannot extend classes, whether abstract or concrete.
Correct Answer: d) All of the above
Explanation:
Interfaces are implicitly abstract. 'public abstract interface' and 'interface' (with package-private access) are both valid.
Correct Answer: c) public abstract
Explanation:
By default, all methods in an interface without bodies are implicitly public and abstract.
Correct Answer: a) public static final
Explanation:
Variables declared in an interface are implicitly public, static, and final (i.e., constants).
Correct Answer: c) All classes directly or indirectly
Explanation:
Every class in Java is a descendant of the Object class, either directly or indirectly.
Correct Answer: d) copy()
Explanation:
The Object class provides clone(), equals(), and hashCode(), but there is no copy() method.
Correct Answer: b) To prevent the Diamond Problem
Explanation:
If a class inherits from two classes that have identical methods, it creates ambiguity on which method to invoke (the Diamond Problem).
Correct Answer: b) Only from inside a subclass constructor as the first statement
Explanation:
The super() call can only be made inside a constructor, and it must be the very first statement.
Correct Answer: a) Yes
Explanation:
Constructor overloading is perfectly valid and common, allowing classes to be instantiated in different ways.
Correct Answer: b) No
Explanation:
Constructors are not inherited by subclasses. Since they are not inherited, they cannot be overridden.
Correct Answer: b) Upcasting
Explanation:
Assigning a subclass object to a superclass reference is known as upcasting, and it is done implicitly in Java.
Correct Answer: c) ClassCastException
Explanation:
A ClassCastException is thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance.
Correct Answer: c) Any class
Explanation:
Unless Class A is abstract or has a private constructor, any class can instantiate it using the new keyword.
Correct Answer: c) The value of the parameter cannot be changed inside the method
Explanation:
A final parameter acts as a constant within the method body, preventing any reassignment.
Correct Answer: b) Make it final
Explanation:
The final keyword prevents subclasses from overriding the specific method.
Correct Answer: b) Yes, starting from Java 8
Explanation:
Java 8 introduced static methods in interfaces. They must have a body and are called using the interface name.
Correct Answer: c) Using the interface name
Explanation:
Static methods in interfaces are strictly invoked using the interface name. They are not inherited by implementing classes.
Correct Answer: b) Strategy pattern
Explanation:
The Strategy pattern allows changing algorithms at runtime, relying heavily on programming to an interface and dynamic polymorphism.
Correct Answer: a) public abstract
Explanation:
Because interface methods are implicitly public and abstract, developers usually omit these keywords for brevity.
Correct Answer: b) An interface with no methods or fields
Explanation:
A marker interface has no methods or fields and is used to provide meta-data to the JVM.
Correct Answer: c) A Functional Interface
Explanation:
A functional interface has exactly one abstract method and can be used as the assignment target for a lambda expression.
Correct Answer: c) @FunctionalInterface
Explanation:
The @FunctionalInterface annotation causes the compiler to generate an error if the interface has more than one abstract method.
Correct Answer: b) No
Explanation:
A class cannot extend itself, as it would cause a cyclic inheritance structure which is strictly prohibited by the Java compiler.
Correct Answer: b) A circular dependency in the inheritance hierarchy
Explanation:
The JVM throws a ClassCircularityError if it detects a loop in the superclass hierarchy of a class.
Correct Answer: b) Local variables cannot be overridden
Explanation:
Local variables are defined within a method block. They are not part of the class schema, so they cannot be inherited, overridden, or hidden by subclasses.
Correct Answer: c) Abstraction
Explanation:
Abstraction hides complex implementation details and exposes only the necessary features of an object.
Correct Answer: b) No, super is tied to an object instance
Explanation:
Static methods belong to the class, not an object instance. The super and this keywords refer to object instances, so they cannot be used in a static context.
Correct Answer: b) No
Explanation:
Like super, the this keyword refers to the current object instance, which does not exist in a static context.
Correct Answer: b) The subclass constructor must declare the exception (or its supertype) in its throws clause
Explanation:
Since super() must be the first line, a try-catch cannot surround it. Therefore, the subclass constructor must declare the checked exception in its throws clause.
Correct Answer: c) hashCode()
Explanation:
The contract between equals() and hashCode() requires that if two objects are equal according to equals(), they must return the same hashCode.
Correct Answer: b) protected
Explanation:
The clone() method in java.lang.Object is protected, meaning a class must explicitly override it and make it public to allow deep or shallow copies from outside.
Correct Answer: c) It causes a compile-time error
Explanation:
Java forces the developer to resolve the multiple-inheritance ambiguity. The class will not compile until it overrides the show() method.
Correct Answer: b) A class defined within another class
Explanation:
Inner classes (or nested classes) are classes declared entirely within the body of another class or interface.
Correct Answer: a) Yes
Explanation:
An inner class is a full-fledged class and can extend another class, implement interfaces, etc., just like a normal top-level class.
Correct Answer: c) A class without a name that is instantiated simultaneously
Explanation:
Anonymous inner classes have no name and are created and instantiated in a single expression, usually to override a specific method of a class or interface.
Correct Answer: b) It allows a single interface to represent different underlying forms
Explanation:
Polymorphism allows objects of different types to be treated as instances of the same class through a common interface or superclass.
Correct Answer: b) Any unchecked exception, or no exception
Explanation:
Unchecked exceptions are not strictly checked by the compiler. An overriding method can throw any unchecked exceptions, regardless of what the parent throws.
Correct Answer: c) The reference type restricts access to superclass methods only
Explanation:
Upcasting restricts visibility to the methods and fields defined in the superclass (or interface), although the overridden methods will still execute.
Correct Answer: c) Composition
Explanation:
Has-a signifies Composition or Aggregation, where Object A contains a reference to Object B.
Correct Answer: b) Interfaces
Explanation:
Interfaces completely avoid the Diamond Problem by abstracting the implementation.
Correct Answer: b) No, it requires explicit downcasting
Explanation:
A superclass object cannot be assigned to a subclass reference implicitly. It must be explicitly cast, which may throw a ClassCastException if invalid.
Correct Answer: b) false
Explanation:
The instanceof operator always returns false if the left operand is null, because null is not an instance of any object.
Correct Answer: b) Method Overloading
Explanation:
Method overloading is resolved at compile-time (static binding), based on the reference type and parameter signatures.
Correct Answer: a) Abstract classes can have state (instance variables), interfaces cannot
Explanation:
Abstract classes can declare instance variables and maintain state. Interfaces can only declare constant variables.
Correct Answer: b) No
Explanation:
An abstract class is meant to be subclassed, while a final class cannot be subclassed. The two keywords are mutually exclusive.
Correct Answer: b) Linking a method call to a method body at run-time
Explanation:
Dynamic binding (or late binding) resolves the method call at run-time based on the actual object type. This is how method overriding is executed.
Correct Answer: a) Resolving a method call at compile-time
Explanation:
Static binding (early binding) occurs at compile-time. Overloaded methods, private methods, final methods, and static methods use static binding.
Correct Answer: b) Static Binding
Explanation:
Because final methods cannot be overridden, the compiler knows exactly which method implementation to call, so it uses static binding.
Correct Answer: c) transient
Explanation:
While unrelated to polymorphism directly, transient fields are ignored during Java serialization, distinguishing them from inherited object state.
Correct Answer: b) No
Explanation:
An overriding method cannot throw checked exceptions that are new or broader than those declared by the overridden method.
Correct Answer: b) Dog's bark() is executed
Explanation:
Due to runtime polymorphism (dynamic method dispatch), the JVM invokes the overridden method of the actual object (Dog) being referred to.
Correct Answer: c) A compilation error occurs in the child class
Explanation:
The child class constructor implicitly calls super(). If the parent has no default constructor, the developer must explicitly call the parameterized super(...) to avoid a compilation error.
Correct Answer: c) Polymorphism
Explanation:
Polymorphism literally translates to many forms and allows objects to be treated as instances of their parent class rather than their actual class.
Correct Answer: a) Method signatures
Explanation:
Methods must have unique signatures. A method signature in Java consists of the method name and the parameter list.
Correct Answer: b) No
Explanation:
Parameter names do not matter to the compiler. Overloading requires a change in the type, number, or order of the parameters.
Correct Answer: b) No, instance variables are hidden, not overridden
Explanation:
Java supports method overriding but not variable overriding. Variables are resolved based on the reference type (hiding), not the object type.
Correct Answer: c) Liskov Substitution Principle
Explanation:
The Liskov Substitution Principle (part of SOLID) states that derived classes must be substitutable for their base classes.
Correct Answer: b) Yes, but C must override run() to resolve the ambiguity
Explanation:
Java allows multiple inheritance of interfaces, but if a method signature conflict arises with default methods, the implementing class must override it.
Correct Answer: a) Yes, automatically (Array covariance)
Explanation:
Java arrays are covariant, meaning if Sub is a subtype of Super, then Sub[] is a subtype of Super[].
Correct Answer: b) ArrayStoreException
Explanation:
If a Sub[] is referenced by a Super[], and you try to put a different sibling Sub2 into it, Java throws an ArrayStoreException at runtime.
Correct Answer: a) java.lang.String
Explanation:
The String class in Java is declared as final to maintain immutability and security, hence it cannot be subclassed.
Correct Answer: c) Assigning a subclass object to a superclass value, losing subclass specifics
Explanation:
Common in C++, object slicing occurs when assigning a derived object to a base object by value. In Java, objects are managed by reference, so actual object slicing does not happen.
Correct Answer: b) MyInterface.super.methodName()
Explanation:
To invoke a specific interface's default method, the syntax InterfaceName.super.methodName() is used.
Correct Answer: b) No
Explanation:
The final modifier on a method explicitly prevents any subclass from overriding it.
Correct Answer: b) No
Explanation:
Abstract methods must be implemented by subclasses. A private method is not visible to subclasses, making it impossible to implement.
Correct Answer: b) No
Explanation:
Static methods belong to the class and are resolved at compile time, whereas abstract methods require dynamic resolution via subclasses.
Correct Answer: b) obj instanceof MyClass
Explanation:
The instanceof keyword evaluates if the left-side reference is an instance of the right-side type.
Correct Answer: b) No, they remain in memory but are hidden from the reference
Explanation:
Upcasting changes the reference type, restricting access to subclass-specific members, but the underlying object in memory remains completely intact.
Correct Answer: b) A class that restricts which other classes can extend it
Explanation:
Sealed classes (and interfaces) limit inheritance to a known set of subclasses, specified using the permits clause.
Correct Answer: b) No
Explanation:
The compiler uses the method signature (name and parameter list) to distinguish overloaded methods. The return type is ignored for signature matching.
Correct Answer: c) A subclass of the return type in the overridden method
Explanation:
Covariant return types allow a subclass method to return a more specific type (a subclass) than the method it overrides.
Related Posts

JavaScript This Keyword & Scope MCQs
Variable scoping and declaration keywords (var, let, and const) determine where identifiers are visible and accessible within a JavaScript execution…
August 29, 2026By MCQs Generator

Java Interview Questions MCQs
Preparing for technical interviews requires a deep understanding of object-oriented programming paradigms, memory management, runtime behavior, and modern language enhancements.…
October 19, 2026By MCQs Generator

Java Multithreading & Concurrency MCQs
Java multithreading and concurrency are core pillars for building high-performance, responsive applications that execute multiple tasks simultaneously. Utilizing the java.util.concurrent…
October 19, 2026By MCQs Generator
Related Categories

AI & Data Science MCQ
5 topics
By MCQs Generator

Arts & Humanities MCQ
4 topics
By MCQs Generator

Civil Engineering MCQ
4 topics
By MCQs Generator

Commerce & Business MCQ
4 topics
By MCQs Generator

Competitive Exams MCQ
5 topics
By MCQs Generator

Electrical & Electronics Engineering MCQ
3 topics
By MCQs Generator

General Knowledge MCQ
2 topics
By MCQs Generator

General Science MCQ
4 topics
By MCQs Generator

Law & Judiciary MCQ
3 topics
By MCQs Generator

Mechanical Engineering MCQ
4 topics
By MCQs Generator

Medical & Health Sciences MCQ
4 topics
By MCQs Generator

Modern Tech Fields MCQ
3 topics
By MCQs Generator