Java interfaces and abstract classes are core constructs used to implement abstraction and enforce design contracts in object-oriented architecture. An abstract class permits partial code implementation, state retention via instance variables, and standard single class inheritance, whereas an interface historically defined pure abstract behavior contracts now enhanced with modern default and static methods. Since Java does not support multiple class inheritance, interfaces provide a safe mechanism to achieve multiple inheritance of behavior. Mastering the structural differences and design application rules of both types is vital for software engineering interviews and certification exams.
Java Interfaces and Abstract Classes MCQs
1 min read
Correct Answer: b) abstract
Explanation:
In Java, the abstract keyword is used to declare a class as abstract, meaning it cannot be instantiated.
Correct Answer: b) No, never
Explanation:
Abstract classes are incomplete by design and cannot be instantiated directly. They must be subclassed.
Correct Answer: c) To provide a common base for subclasses to build upon
Explanation:
An abstract class serves as a blueprint for other classes, allowing shared code and defining a common template.
Correct Answer: c) Both abstract and non-abstract methods
Explanation:
Abstract classes can have a mix of abstract methods (without a body) and concrete methods (with a body).
Correct Answer: b) No, an abstract class can have zero abstract methods
Explanation:
An abstract class is not required to have any abstract methods. However, if a class has an abstract method, the class itself must be declared abstract.
Correct Answer: b) No
Explanation:
Java does not support multiple inheritance for classes. A class can extend only one superclass, whether it is abstract or concrete.
Correct Answer: c) implements
Explanation:
The implements keyword is used by a class to implement the methods declared in an interface.
Correct Answer: d) public abstract
Explanation:
By default, all methods in an interface (without a body) are implicitly public and abstract.
Correct Answer: a) public static final
Explanation:
All variables declared in an interface are implicitly public, static, and final (i.e., constants).
Correct Answer: b) Yes, by separating interface names with a comma
Explanation:
Java supports multiple inheritance of type through interfaces. A class can implement any number of interfaces.
Correct Answer: a) Provide implementations for all abstract methods of the interface
Explanation:
A concrete class must provide method bodies for all the abstract methods defined in the interface it implements.
Correct Answer: a) It causes a compilation error unless the class is declared abstract
Explanation:
If a class does not implement all abstract methods of its interfaces, the class itself must be declared abstract; otherwise, it will not compile.
Correct Answer: c) Yes, using the extends keyword
Explanation:
An interface can extend another interface (or multiple interfaces) using the extends keyword.
Correct Answer: b) Default methods
Explanation:
Java 8 introduced default and static methods in interfaces, allowing interfaces to provide method implementations without breaking existing implementations.
Correct Answer: c) To allow adding new methods to interfaces without breaking existing implementations
Explanation:
Default methods allow backward compatibility by providing an implementation that existing classes inherit if they do not override it.
Correct Answer: a) Using the default keyword before the return type
Explanation:
In an interface, a method with an implementation must be marked with the default keyword (or static).
Correct Answer: b) Yes, and it is called when a concrete subclass is instantiated
Explanation:
Abstract classes can have constructors. They are executed during the instantiation of a concrete subclass via the super call.
Correct Answer: b) No
Explanation:
Interfaces cannot have constructors because they cannot maintain state (instance variables) and are not part of the class instantiation chain.
Correct Answer: b) No
Explanation:
An abstract class is meant to be subclassed, while a final class cannot be subclassed. Using both keywords together causes a compilation error.
Correct Answer: b) No
Explanation:
An interface is meant to be implemented. A final modifier prevents implementation, so it is illegal for an interface.
Correct Answer: b) They are called using the interface name
Explanation:
Static methods in interfaces belong to the interface itself and must be invoked using the interface name (e.g., InterfaceName.methodName()).
Correct Answer: c) No, because interfaces do not have instance variables
Explanation:
All variables in an interface are implicitly static and final. Interfaces do not have instance variables.
Correct Answer: c) Private methods
Explanation:
Java 9 introduced private methods (and private static methods) in interfaces to allow code sharing between default and static methods.
Correct Answer: b) To encapsulate helper logic shared among default methods
Explanation:
Private methods in interfaces are used to refactor and share common code between default methods without exposing that logic to the public API.
Correct Answer: c) Class A fails to compile unless it overrides the display() method
Explanation:
This causes the Diamond Problem. The compiler forces Class A to override the conflicting default method to resolve the ambiguity.
Correct Answer: c) B.super.display()
Explanation:
To invoke a specific interface's default method from the overriding method in the class, use the syntax InterfaceName.super.methodName().
Correct Answer: a) Yes
Explanation:
Abstract classes can have static methods, which can be called using the abstract class name.
Correct Answer: b) Yes
Explanation:
An abstract class can have final methods. These methods cannot be overridden by subclasses, ensuring the implementation remains unchanged.
Correct Answer: b) No
Explanation:
An abstract method must be overridden by a subclass, while a final method cannot be overridden. These modifiers contradict each other.
Correct Answer: b) No
Explanation:
Abstract methods must be implemented by a subclass, meaning they must be visible to the subclass. Private methods are not inherited, so they cannot be abstract.
Correct Answer: b) No
Explanation:
Static methods belong to the class and are resolved at compile time, whereas abstract methods rely on dynamic polymorphism (overriding) which is an instance-level concept.
Correct Answer: b) An interface that has exactly one abstract method
Explanation:
A functional interface is an interface that contains exactly one abstract method. It can have multiple default or static methods.
Correct Answer: c) @FunctionalInterface
Explanation:
The @FunctionalInterface annotation tells the compiler to check that the interface has exactly one abstract method.
Correct Answer: b) No, it is optional but recommended
Explanation:
The annotation is optional. Any interface with exactly one abstract method is treated as a functional interface by the compiler, but the annotation prevents accidental addition of abstract methods.
Correct Answer: a) java.lang.Runnable
Explanation:
Runnable has exactly one abstract method (run()) and is a widely used functional interface.
Correct Answer: b) An interface with no methods or fields
Explanation:
A marker interface (like Serializable or Cloneable) has no methods or fields. It provides run-time type information to the JVM.
Correct Answer: c) Serializable
Explanation:
java.io.Serializable is a marker interface. It has no methods and tells the JVM that the object can be serialized.
Correct Answer: b) Abstract classes can maintain state using instance variables, interfaces cannot
Explanation:
Abstract classes can have instance variables to store object state. Variables in interfaces are always public static final (constants), meaning they cannot store instance state.
Correct Answer: c) When classes share a common core implementation and state
Explanation:
Abstract classes are best when you have closely related classes that share code and state (fields). Interfaces are better for defining contracts across unrelated classes.
Correct Answer: b) Yes, and it can leave the interface methods abstract
Explanation:
An abstract class can implement an interface without implementing its methods. The responsibility passes to the first concrete subclass.
Correct Answer: b) public abstract
Explanation:
Method declarations in interfaces without a body or explicitly stated modifiers are implicitly public and abstract.
Correct Answer: b) No
Explanation:
Interface methods can only be public (abstract, default, static) or private (Java 9 and above). Protected access is not allowed.
Correct Answer: d) public
Explanation:
Since interface methods are implicitly public, the implementing class must declare them as public because Java prevents reducing visibility during overriding.
Correct Answer: b) Yes, and it is implicitly public and static
Explanation:
Interfaces can contain nested classes, and they are implicitly public and static.
Correct Answer: b) Yes, and it is implicitly public and static
Explanation:
Just like nested classes, interfaces can contain nested interfaces, which are implicitly public and static.
Correct Answer: b) Yes, overriding Object methods does not count toward the abstract method limit
Explanation:
If an interface declares an abstract method overriding one of the public methods of java.lang.Object (like equals or toString), it does not count against the limit of one abstract method.
Correct Answer: b) It is implicitly public, static, and final
Explanation:
Any field declared inside an interface is automatically implicitly public, static, and final.
Correct Answer: a) Yes
Explanation:
An abstract class can extend a concrete class, just like it can extend another abstract class.
Correct Answer: b) Runnable r = new Runnable() { public void run() {} };
Explanation:
Anonymous classes are created on the fly by combining instantiation and class definition in a single statement using curly braces.
Correct Answer: b) Yes, by providing implementations for its abstract methods inline
Explanation:
While you cannot instantiate an interface directly, you can create an instance of an anonymous inner class that implements the interface.
Correct Answer: b) No, it is optional but highly recommended
Explanation:
The @Override annotation is optional but helps prevent errors (like typos in method names) by instructing the compiler to verify the override.
Correct Answer: a) Yes, for example class A extends B implements C, D
Explanation:
A Java class can extend one superclass (abstract or concrete) and implement any number of interfaces simultaneously. The extends keyword must precede implements.
Correct Answer: c) B.X
Explanation:
Interface variables are static, so the conflict is resolved by referring to the interface explicitly using its name: B.X.
Correct Answer: b) Yes, and it can be used to run the application
Explanation:
An abstract class can contain a valid public static void main(String[] args) method, and the JVM can execute it.
Correct Answer: c) Yes, since Java 8 it is possible and executable
Explanation:
Starting in Java 8, interfaces can have static methods, including a public static void main method, allowing them to serve as the entry point.
Correct Answer: b) final
Explanation:
The final modifier prevents subclassing, which contradicts the purpose of an abstract class.
Correct Answer: a) Yes
Explanation:
An abstract subclass does not have to implement the abstract methods inherited from its parent abstract class. The obligation falls to the first concrete subclass.
Correct Answer: a) No, concrete classes cannot contain abstract methods
Explanation:
A concrete class cannot contain or declare abstract methods. Doing so requires the class itself to be marked as abstract.
Correct Answer: b) The compiler generates a default no-argument constructor
Explanation:
Just like regular classes, if no constructor is defined in an abstract class, the compiler automatically provides a default no-argument constructor.
Correct Answer: b) java.lang.Cloneable
Explanation:
The java.lang.Cloneable interface is a marker interface used to indicate that the Object.clone() method is legal for instances of that class.
Correct Answer: c) It uses the default Object.clone() shallow copy implementation
Explanation:
Since Cloneable is a marker interface, it has no methods. Implementing it allows the protected Object.clone() method to create a shallow copy without throwing an exception.
Correct Answer: c) Predicate
Explanation:
java.util.function.Predicate is a functional interface representing a predicate (boolean-valued function) of one argument.
Correct Answer: a) Supplier
Explanation:
java.util.function.Supplier is a functional interface representing a supplier of results, which takes no arguments.
Correct Answer: b) Yes, by omitting the access modifier
Explanation:
Interfaces can be package-private (accessible only within the same package) if no access modifier is specified.
Correct Answer: b) No
Explanation:
Top-level classes (including abstract classes) can only be public or package-private. They cannot be private or protected.
Correct Answer: c) No, because it is implicitly final
Explanation:
Interface variables are implicitly static and final, making them constants. Their values cannot be modified once initialized.
Correct Answer: b) No, because final classes cannot be extended
Explanation:
A final class explicitly prevents any class (abstract or concrete) from extending it.
Correct Answer: c) An abstract class
Explanation:
An abstract class is required because it can hold state (instance variables) while defining abstract methods that force subclass implementation.
Correct Answer: a) Default methods cannot access instance state, whereas abstract class methods can
Explanation:
Interfaces do not have instance state (fields), so default methods cannot access or mutate object state, unlike concrete methods in abstract classes.
Correct Answer: b) Comparable
Explanation:
The java.lang.Comparable interface imposes a total ordering on the objects of each class that implements it, via the compareTo method.
Correct Answer: c) Concrete class (final)
Explanation:
String is a final, concrete class in Java.
Correct Answer: b) No, interfaces cannot have static initialization blocks
Explanation:
Interfaces are not allowed to have static initializer blocks. Constants must be initialized at the time of declaration.
Correct Answer: a) Yes
Explanation:
Abstract classes are standard classes and can contain static initializer blocks, instance initializer blocks, and constructors.
Correct Answer: c) The class method overrides the default method
Explanation:
Class implementations always win over interface default implementations. The class method takes precedence.
Correct Answer: a) Yes, classes always win over interfaces
Explanation:
According to Java's inheritance rules, a method inherited from a superclass (abstract or concrete) always takes precedence over a default method from an interface.
Correct Answer: a) Class D compiles successfully and inherits C's default method
Explanation:
Because neither A nor B override C's default method, there is only one implementation (from C), so no ambiguity exists and D compiles successfully.
Correct Answer: b) D inherits A's overridden default method
Explanation:
The most specific default-providing interface wins. Since A extends C and provides a more specific implementation, A's method is inherited by D.
Correct Answer: b) sealed
Explanation:
Java 15 introduced sealed classes and interfaces, which restrict which other classes or interfaces may extend or implement them using the permits clause.
Correct Answer: a) Yes
Explanation:
Both classes and interfaces can be sealed in modern Java to restrict their implementation or extension.
Correct Answer: a) They must be final, sealed, or non-sealed
Explanation:
Subclasses or implementers of a sealed class/interface must explicitly declare themselves as final (if a class), sealed, or non-sealed.
Correct Answer: b) Programming to an interface, not an implementation
Explanation:
Using interfaces promotes loose coupling and abstraction, forming the core of the principle program to an interface, not an implementation.
Correct Answer: a) Yes
Explanation:
Abstract classes can declare instance variables with standard modifiers, including volatile for thread safety.
Correct Answer: b) No, because interface variables are implicitly final
Explanation:
A variable cannot be both final and volatile in Java. Since interface fields are implicitly final, they cannot be volatile.
Correct Answer: b) Iterable
Explanation:
The java.lang.Iterable interface provides the iterator() method and is the root interface for collection iteration, enabling the enhanced for-loop.
Correct Answer: b) Interface
Explanation:
java.util.List is a core interface in the Java Collections Framework.
Correct Answer: a) Yes, always
Explanation:
Every class in Java, whether abstract or concrete, inherits directly or indirectly from java.lang.Object.
Correct Answer: b) No, interfaces do not extend Object, but they implicitly declare Object's public methods
Explanation:
Interfaces do not extend java.lang.Object (since they are not classes), but they implicitly declare all public methods of Object (like equals, hashCode).
Correct Answer: a) Yes, for example abstract class MyClass
Explanation:
Abstract classes support generics exactly like concrete classes and interfaces.
Correct Answer: a) Yes, for example interface MyInterface
Explanation:
Interfaces fully support generics.
Correct Answer: a) It uses java.lang.Object as the type (raw type)
Explanation:
If the type parameter is omitted, it becomes a raw type, and the generic type resolves to Object, triggering a compiler warning.
Correct Answer: b) With the class name in italics
Explanation:
In standard UML notation, abstract classes and abstract methods are denoted by writing their names in italics.
Correct Answer: d) Both b and c
Explanation:
Interfaces are marked with the stereotype, and implementation is shown with a dashed line with an open arrow.
Correct Answer: a) Factory Method
Explanation:
The Factory Method pattern relies heavily on abstract classes or interfaces to let subclasses decide which class to instantiate.
Correct Answer: a) An interface declared inside a class or another interface
Explanation:
Nested interfaces (inner interfaces) are declared inside another class or interface and are implicitly static.
Correct Answer: b) No
Explanation:
Overriding equals() is entirely optional. If not overridden, it inherits the implementation from java.lang.Object.
Correct Answer: b) No, interface variables are final and must be initialized upon declaration
Explanation:
Because all interface variables are implicitly public static final, they must be assigned a value immediately when declared.
Correct Answer: b) An Abstract Class
Explanation:
The Template Method pattern relies on an abstract class where a concrete method (the template) calls abstract methods that subclasses implement.
Correct Answer: a) It defines what to do but not how to do it
Explanation:
A pure interface establishes a contract (the what) leaving the implementation (the how) entirely to the implementing classes.
Correct Answer: b) No, a class cannot extend an interface, it must implement it
Explanation:
Classes (abstract or concrete) always implement interfaces. They do not extend them.
Correct Answer: b) No
Explanation:
Lambda expressions evaluate to instances of functional interfaces, not abstract classes, even if the abstract class has only one abstract method.
Correct Answer: b) Yes, starting in Java 9
Explanation:
Java 9 added support for both private instance methods and private static methods in interfaces.
Correct Answer: c) Neither abstract nor default methods can be marked synchronized
Explanation:
The synchronized keyword relates to implementation details (locks). Interface methods (abstract, default, or static) cannot be declared as synchronized.
Correct Answer: a) Yes, but only concrete methods can be synchronized
Explanation:
Concrete methods in an abstract class can be synchronized. Abstract methods cannot be synchronized because synchronization is an implementation detail.
Correct Answer: b) ClassCastException
Explanation:
While the compiler might allow the cast (since a subclass could potentially implement it), at runtime, it will fail and throw a ClassCastException.
Correct Answer: d) All of the above
Explanation:
Any field declared in an interface is implicitly public static final, so all those declarations mean the exact same thing.
Correct Answer: c) No, interface static methods are not inherited
Explanation:
Unlike class static methods, interface static methods are not inherited. They can only be accessed using the Interface name directly.
Correct Answer: c) It compiles successfully
Explanation:
It is perfectly legal to have an abstract class without any abstract methods.
Correct Answer: a) Yes
Explanation:
Abstract classes follow the same variable shadowing rules as normal classes. If it declares a variable with the same name, it shadows the superclass variable.
Correct Answer: c) Bootstrap ClassLoader
Explanation:
Standard core Java API classes and interfaces are loaded by the Bootstrap ClassLoader.
Correct Answer: b) Factory Pattern
Explanation:
The Factory Pattern encapsulates the creation logic and returns an interface or abstract class type, hiding the concrete implementation from the client.
Correct Answer: c) Concrete class
Explanation:
Thread is a concrete class. However, it implements the functional interface Runnable.
Correct Answer: c) It can throw IOException, any subclass of IOException, or no exception at all
Explanation:
An overriding method can choose not to throw the checked exception, or it can throw the same exception or a subclass of it. It cannot throw a broader exception.
Correct Answer: b) No, it throws an InstantiationException
Explanation:
Reflection cannot bypass the rule that interfaces and abstract classes cannot be instantiated. It throws InstantiationException.
Correct Answer: b) A pattern considered an anti-pattern in Java
Explanation:
The Constant Interface pattern is considered an anti-pattern because it pollutes the implementing class's public API with implementation details. Static import is the preferred approach.
Correct Answer: b) Yes, there is no conflict because interface static methods are not inherited
Explanation:
Since static methods in interfaces must be invoked using the interface name, there is no ambiguity or conflict for the implementing class.
Correct Answer: c) They are not serialized because they are static
Explanation:
Static fields belong to the class/interface, not the object instance. Serialization only saves instance state, so static interface variables are never serialized.
Correct Answer: c) Loose coupling and easier testability
Explanation:
By depending on interfaces rather than concrete classes, you can swap implementations easily, facilitating modularity and unit testing.
Correct Answer: b) It refers to the instance of the class implementing the interface
Explanation:
In a default method, this refers to the current object instance of the concrete class that implements the interface.
Correct Answer: b) Yes, but only for concrete methods
Explanation:
The strictfp modifier ensures consistent floating-point calculations. Since abstract methods have no body, they cannot be marked strictfp. Concrete methods can.
Correct Answer: a) Yes, and it makes all default methods strictfp
Explanation:
An interface can be declared strictfp, which applies the strict floating-point rules to all concrete (default and static) methods within it.
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

C++ Memory Management MCQs
Memory management in C++ empowers developers with direct control over hardware resources, primarily through the allocation and deallocation of memory…
October 20, 2026By MCQs Generator

Java Inheritance and Polymorphism MCQs
Java inheritance and polymorphism form the bedrock of Object-Oriented Programming (OOP), enabling code reuse and flexible runtime behavior. Inheritance allows…
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