Object-Oriented Programming (OOP) is the core paradigm underlying Java, designed to organize software design around data, or objects, rather than functions and logic. The Java OOP model rests on four fundamental pillars: encapsulation, inheritance, polymorphism, and abstraction. By utilizing classes as blueprints, Java allows developers to create modular, reusable, and maintainable code structures. Features like dynamic method dispatch enable runtime polymorphism, while access modifiers and interfaces provide robust data hiding and contract-based design. Mastering these principles is absolutely critical for building enterprise-grade Java applications and succeeding in technical software engineering interviews.
Latest Java OOP MCQs
1 min read
Correct Answer: d) Compilation
Explanation:
Compilation is a phase of transforming source code to bytecode. The four main OOP principles are Encapsulation, Inheritance, Polymorphism, and Abstraction.
Correct Answer: b) An instance of a class that has state and behavior
Explanation:
An object is a runtime entity with its own state (fields) and behavior (methods), instantiated from a class template.
Correct Answer: c) new
Explanation:
The 'new' keyword instantiates a class by dynamically allocating memory for a new object at runtime.
Correct Answer: b) A logical template or blueprint used to create objects
Explanation:
A class is a logical blueprint that defines the variables and methods common to all objects of a certain kind.
Correct Answer: b) Heap memory
Explanation:
In Java, objects and their instance variables are stored in the Heap memory space.
Correct Answer: a) State
Explanation:
The 'state' of an object is represented by its fields or properties (instance variables) at any given moment.
Correct Answer: c) Methods
Explanation:
Methods define the behavior or actions that an object can perform and how it can interact with its data.
Correct Answer: b) The compiler automatically provides a default, no-argument constructor
Explanation:
If no constructors are explicitly written, the Java compiler injects a default, no-parameter constructor.
Correct Answer: b) Constructors must have the exact same name as the class
Explanation:
A constructor must exactly match the class name and must not have an explicit return type, not even void.
Correct Answer: a) Yes, by providing multiple constructors with different parameter lists
Explanation:
Constructor overloading is perfectly valid and is achieved by declaring multiple constructors with different parameter signatures.
Correct Answer: c) Wrapping data and code acting on the data into a single unit
Explanation:
Encapsulation binds data and the methods that operate on that data into a single capsule, usually by making fields private and providing public getters/setters.
Correct Answer: b) Using the 'private' access modifier for instance variables
Explanation:
By declaring variables as private, they cannot be accessed directly outside the class, thereby achieving data hiding.
Correct Answer: a) public
Explanation:
The 'public' modifier allows a class, method, or variable to be accessed from any other class in any package.
Correct Answer: c) Accessible within the same package and subclasses outside the package
Explanation:
Protected members are visible to all classes in the same package, and to subclasses regardless of the package they belong to.
Correct Answer: d) package-private (default)
Explanation:
Without an explicit modifier, a member assumes package-private visibility, meaning it is accessible only to classes within the same package.
Correct Answer: a) A process where one object acquires the properties and behaviors of a parent object
Explanation:
Inheritance allows a new class (subclass) to absorb the attributes and methods of an existing class (superclass), promoting code reusability.
Correct Answer: c) extends
Explanation:
The 'extends' keyword is used by a class to inherit from a superclass.
Correct Answer: c) No, it causes the diamond problem, so it is unsupported for classes
Explanation:
To prevent ambiguity known as the diamond problem, Java only allows a class to extend one parent class. Multiple inheritance is achieved through interfaces.
Correct Answer: b) java.lang.Object
Explanation:
Every class in Java implicitly or explicitly extends the java.lang.Object class, making it the root of the Java class hierarchy.
Correct Answer: c) Multilevel inheritance
Explanation:
A chain of inheritance where a subclass itself becomes the superclass for another class is known as multilevel inheritance.
Correct Answer: b) To refer to the immediate parent class instance variable, method, or constructor
Explanation:
The 'super' reference variable accesses members of the immediate parent class, especially useful when subclass members hide parent members.
Correct Answer: b) super()
Explanation:
The 'super()' call invokes the parent class constructor. It must be the very first statement inside the subclass constructor.
Correct Answer: c) Constructors are not inherited by subclasses
Explanation:
Constructors are not members of a class in the same way methods are, so they are not inherited. However, subclass constructors implicitly invoke the parent's no-arg constructor.
Correct Answer: b) The ability of an object to take on many forms
Explanation:
Polymorphism (many forms) allows a single action to behave differently based on the object that is invoking it.
Correct Answer: b) Method Overloading
Explanation:
Method overloading is resolved at compile time (early binding) by matching the method signature.
Correct Answer: a) Method Overriding
Explanation:
Method overriding is resolved dynamically at runtime based on the actual object type, known as late binding.
Correct Answer: c) Methods must have the same name but different parameter lists
Explanation:
Overloading occurs in the same class when methods share a name but differ in the number, type, or sequence of parameters.
Correct Answer: a) The method must have the same name, same parameters, and be in a child class
Explanation:
Overriding requires the same method signature (name and parameters) as the parent class method, providing a specific implementation.
Correct Answer: b) No, static methods belong to the class and are hidden, not overridden
Explanation:
If a subclass defines a static method with the same signature as a superclass static method, it hides the superclass method; this is called Method Hiding, not Overriding.
Correct Answer: b) No, private methods are not visible to subclasses
Explanation:
Private methods are bound to their class and are entirely invisible to child classes, making overriding impossible.
Correct Answer: b) Changing the return type of the overriding method to a subclass type of the original return type
Explanation:
Since Java 5.0, an overridden method can return a subtype of the type returned by the overridden method, ensuring type safety.
Correct Answer: c) final
Explanation:
Marking a class as 'final' prevents any other class from extending it. E.g., the String class is final.
Correct Answer: b) The method cannot be overridden by subclasses
Explanation:
A final method cannot be modified or overridden by any child class, securing its implementation.
Correct Answer: c) Hiding internal implementation details and showing only essential features
Explanation:
Abstraction focuses on what an object does instead of how it does it, reducing complexity for the user.
Correct Answer: b) Using abstract classes and interfaces
Explanation:
Abstract classes provide partial abstraction, while interfaces (traditionally) provide 100% abstraction.
Correct Answer: c) They cannot be instantiated
Explanation:
Abstract classes are incomplete blueprints. They are designed to be inherited, not instantiated directly.
Correct Answer: b) Yes, to initialize variables declared in the abstract class when a subclass is instantiated
Explanation:
Abstract classes can have constructors. They are called implicitly when a concrete subclass is instantiated to set up inherited state.
Correct Answer: b) A method declared without a body, ending with a semicolon
Explanation:
Abstract methods lack an implementation (body). The subclass is forced to provide the implementation.
Correct Answer: b) No, an abstract class can have zero abstract methods
Explanation:
You can declare a class abstract even if it has no abstract methods, purely to prevent direct instantiation.
Correct Answer: c) The subclass itself must be declared abstract
Explanation:
If a child class fails to implement inherited abstract methods, it remains incomplete and must also be marked abstract.
Correct Answer: b) A contract that completely hides implementation details, traditionally containing only abstract methods
Explanation:
An interface specifies a set of methods that a class must implement, defining 'what' to do without dictating 'how'.
Correct Answer: b) implements
Explanation:
A class 'implements' an interface, committing to provide bodies for all its abstract methods.
Correct Answer: b) Yes, Java supports multiple inheritance of type through interfaces
Explanation:
While a class can extend only one parent class, it can implement any number of interfaces.
Correct Answer: c) public static final
Explanation:
All fields in an interface are implicitly public, static, and final (constants) by default.
Correct Answer: a) public abstract
Explanation:
Methods without a body in an interface are implicitly public and abstract.
Correct Answer: b) Yes, using the 'default' and 'static' keywords
Explanation:
Java 8 introduced default and static methods in interfaces, allowing them to provide concrete implementations.
Correct Answer: b) An interface with no methods or fields, used to indicate something to the compiler or JVM
Explanation:
Examples include Serializable and Cloneable. They tag a class to signal specific capabilities to the JVM.
Correct Answer: b) An interface containing exactly one abstract method
Explanation:
Functional interfaces (e.g., Runnable, Callable) have only one abstract method and are the basis for Lambda expressions in Java 8.
Correct Answer: b) @FunctionalInterface
Explanation:
This annotation prevents accidental addition of multiple abstract methods, generating a compiler error if the rule is violated.
Correct Answer: c) Yes, using the 'extends' keyword
Explanation:
An interface can extend one or more other interfaces, inheriting their abstract methods.
Correct Answer: b) The current instance of the class
Explanation:
The 'this' reference points to the specific object upon which a non-static method or constructor is being invoked.
Correct Answer: b) No, because static methods don't belong to any specific instance
Explanation:
Since static methods are class-level and called without creating instances, there is no 'this' object available.
Correct Answer: b) Calling one constructor from another constructor within the same class using this()
Explanation:
Using 'this(parameters)', a constructor can call another overloaded constructor in the same class to avoid code duplication.
Correct Answer: b) A variable shared among all instances of a class
Explanation:
Static variables belong to the class itself, meaning only one copy exists in memory, shared by all objects of that class.
Correct Answer: c) When the class is loaded into memory by the classloader
Explanation:
Static initializer blocks run exactly once, at the time the JVM loads the class into memory.
Correct Answer: d) Both b and c
Explanation:
Association defines a connection between classes. Composition and Aggregation (HAS-A) are forms of association.
Correct Answer: b) A weak HAS-A relationship where the child object can exist independently of the parent
Explanation:
In aggregation (e.g., Department has Teachers), if the parent is destroyed, the child objects can still exist independently.
Correct Answer: a) A strong HAS-A relationship where child objects cannot exist independently of the parent
Explanation:
In composition (e.g., House has Rooms), if the House is destroyed, the Rooms are also destroyed.
Correct Answer: b) Composition provides better encapsulation and prevents rigid, fragile class hierarchies
Explanation:
Composition allows dynamic behavior changes at runtime and avoids the tight coupling that inheritance enforces.
Correct Answer: b) A class defined within the body of another class
Explanation:
Inner classes logically group classes that are only used in one place, increasing encapsulation and readability.
Correct Answer: a) An inner class that has no name, typically instantiated right where it is declared
Explanation:
Anonymous classes are used to instantiate objects with certain 'one-off' modifications without formally defining a new subclass.
Correct Answer: b) The mechanism by which a call to an overridden method is resolved at runtime rather than compile time
Explanation:
This is the essence of runtime polymorphism in Java. The JVM determines the actual object type at runtime to invoke the correct overridden method.
Correct Answer: c) Assigning a subclass object to a superclass reference variable
Explanation:
Upcasting (Parent p = new Child()) happens automatically and allows for polymorphic array collections and method parameters.
Correct Answer: b) Explicitly casting a superclass reference back to a subclass type
Explanation:
Downcasting (Child c = (Child) p) is required to access child-specific methods that are not declared in the parent reference type.
Correct Answer: b) instanceof
Explanation:
The 'instanceof' operator tests whether an object is an instance of a specific class or interface, preventing ClassCastExceptions.
Correct Answer: c) ClassCastException
Explanation:
If the actual runtime object is not of the type you are attempting to cast it to, a ClassCastException is thrown.
Correct Answer: b) No, constructors cannot be inherited, so making them final is illegal
Explanation:
Because constructors are not inherited, they can never be overridden, making the 'final' keyword on them logically useless and structurally illegal.
Correct Answer: b) It ensures that only one instance of the class is created in the JVM
Explanation:
Singleton limits instantiation to one object. It is typically implemented with a private constructor and a static getInstance method.
Correct Answer: c) Declare the constructor as private
Explanation:
A private constructor prevents external classes from instantiating the class, forcing them to use the controlled static factory method.
Correct Answer: b) A special class that represents a group of constants (unchangeable variables)
Explanation:
Enums are reference types that define a fixed set of constants. They can also have fields, constructors, and methods.
Correct Answer: c) No, because all enums implicitly extend java.lang.Enum
Explanation:
Since Java does not support multiple class inheritance, and enums implicitly extend java.lang.Enum, they cannot extend another class. (They can implement interfaces).
Correct Answer: b) Single Responsibility Principle
Explanation:
SRP states that a class should have one, and only one, reason to change, meaning it should only have one job or responsibility.
Correct Answer: b) Software entities should be open for extension, but closed for modification
Explanation:
You should be able to add new functionality without altering existing, tested code, typically via inheritance and polymorphism.
Correct Answer: a) When a group of classes are highly dependent on one another
Explanation:
Tight coupling implies changes in one class severely impact other classes. OOP design favors loose coupling via interfaces.
Correct Answer: c) The degree to which the elements inside a class belong together
Explanation:
High cohesion means a class does exactly one defined job efficiently. Low cohesion means a class does many unrelated jobs.
Correct Answer: b) It must be initialized, and its value cannot be changed once assigned
Explanation:
Final variables are constants; once they are assigned a value, it becomes immutable.
Correct Answer: b) A final variable that is not initialized at the time of declaration
Explanation:
A final variable not assigned a value upon declaration is a blank final variable. It must be initialized inside all constructors.
Correct Answer: c) Inheritance
Explanation:
When class Dog extends Animal, it is accurate to say 'Dog IS-A Animal', which represents inheritance.
Correct Answer: c) A compilation error occurs
Explanation:
Interfaces cannot be instantiated directly using 'new'. A class must implement it, and then the class can be instantiated.
Correct Answer: c) implements
Explanation:
A class 'implements' an interface, ensuring it fulfills the contract set by the interface.
Correct Answer: b) Yes, we can overload it by passing different parameters
Explanation:
You can have multiple main methods with different parameter types, but the JVM will only auto-execute the standard public static void main(String[] args).
Correct Answer: c) internal
Explanation:
'internal' is an access modifier in languages like C#, but in Java, the equivalent package-private is achieved by using no modifier at all.
Correct Answer: c) Object class constructor
Explanation:
Constructors execute from the top of the inheritance tree downwards. Object() runs, then Class B's, and finally Class A's.
Correct Answer: b) Variable hiding (Shadowing) occurs
Explanation:
Variables in Java are not polymorphic. The child class variable hides the parent class variable. Access depends on the reference type.
Correct Answer: c) They are implicitly public and abstract
Explanation:
By language specification, all standard methods in an interface are implicitly public and abstract.
Correct Answer: d) None of the above
Explanation:
Constructors do not have a return type, not even void. Writing 'void' turns the constructor into a regular method.
Correct Answer: b) To mark a variable to be ignored during object serialization
Explanation:
When an object is serialized, variables marked as 'transient' are not serialized and their values are lost (reset to defaults).
Correct Answer: c) To perform cleanup operations before an object is garbage collected
Explanation:
The finalize() method is called by the Garbage Collector before removing the object from memory, though its use is deprecated in modern Java.
Correct Answer: a) Interfaces
Explanation:
Interfaces allow components to interact without knowing each other's strict implementations, leading to loosely coupled code.
Correct Answer: b) Mark the method as final
Explanation:
Applying the 'final' keyword to a method explicitly prevents any subclass from overriding it.
Correct Answer: b) No, it results in a compile-time error
Explanation:
A method signature consists of the name and parameter list. A class cannot compile if it has two methods with identical signatures.
Correct Answer: b) Creating an exact, independent copy of an object's state in a new memory location
Explanation:
Cloning creates a duplicate object. In Java, this is usually achieved by implementing the Cloneable interface and overriding clone().
Correct Answer: b) A copy of the reference to the object is passed
Explanation:
Java strictly uses pass-by-value. For objects, the value passed is a copy of the memory reference, meaning internal state can be mutated, but assigning a new object won't affect the original reference.
Correct Answer: c) Association (Uses-A)
Explanation:
Dependency often represents a 'Uses-A' relationship, where one object relies on another temporarily (e.g., as a method parameter).
Correct Answer: b) The child class constructor must declare or catch the exception
Explanation:
Because the child constructor implicitly calls the parent constructor, any checked exceptions thrown by the parent must be handled by the child.
Correct Answer: b) You are trying to call a method or access a field on a reference that points to nothing (null)
Explanation:
NPE occurs when the reference variable holds null but the program attempts to dereference it for state or behavior.
Correct Answer: b) Yes, this is known as a nested interface
Explanation:
Nested interfaces are allowed. They are implicitly static and are typically used to group strongly related types.
Correct Answer: b) Delegates the responsibility of object instantiation to a specialized method
Explanation:
Factory methods return instances of objects, abstracting the 'new' keyword away from the client code to support flexibility.
Correct Answer: a) Polymorphism / Overriding
Explanation:
Overriding a generalized parent method to provide specialized behavior in a subclass is a prime example of polymorphism.
Correct Answer: b) Directly using the Interface name (InterfaceName.variableName)
Explanation:
Because they are static, interface constants are accessed statically using the interface's type name.
Correct Answer: b) Yes, there is no restriction on this
Explanation:
An abstract class can perfectly extend a concrete class, gaining its implemented methods while possibly adding its own abstract ones.
Correct Answer: b) Upcasting (Subclass to Superclass)
Explanation:
Since a subclass IS-A superclass, assigning it to a superclass reference (upcasting) is strictly type-safe and done implicitly by the compiler.
Correct Answer: b) Objects of a superclass should be replaceable with objects of its subclasses without breaking the application
Explanation:
LSP ensures that inheritance is used correctly, and that derived classes functionally honor the contract established by base classes.
Correct Answer: b) No, interfaces do not maintain state and cannot be instantiated directly
Explanation:
Since interfaces cannot hold instance state (fields), they do not have constructors to initialize anything.
Correct Answer: a) Yes, it can leave the implementation to its concrete subclasses
Explanation:
An abstract class can declare that it implements an interface, passing the burden of actual method implementation to the first concrete subclass.
Correct Answer: b) this or super
Explanation:
If a local variable shadows an instance variable, 'this.var' accesses the instance. If a subclass variable shadows a parent's, 'super.var' accesses the parent's.
Correct Answer: b) Plain Old Java Object
Explanation:
A POJO is a standard, unburdened Java object not bound by any special restriction, framework, or interface.
Correct Answer: b) A POJO with private fields, public getters/setters, and a no-arg constructor
Explanation:
Java Beans follow strict encapsulation and instantiation conventions, allowing them to be reusable and serializable.
Correct Answer: c) Factory Method
Explanation:
The Factory Method pattern defines an interface for creating objects, deferring the specific instantiation logic to subclasses.
Correct Answer: b) Singleton
Explanation:
Singleton ensures exactly one instance exists, which is ideal for shared resources like database connection pools.
Correct Answer: b) Yes, by making its constructor private
Explanation:
A final class cannot be extended, but its instantiation can still be prevented by declaring a private constructor (e.g., java.lang.Math).
Correct Answer: b) No, it is a standard library feature, though Strings in Java are implemented as Objects
Explanation:
String manipulation is part of Java's standard API logic, not a core theoretical principle of OOP like Inheritance or Polymorphism.
Correct Answer: b) Method Overloading
Explanation:
The println() method is highly overloaded in the PrintStream class to accept int, double, String, Object, etc.
Correct Answer: b) The measure of how closely connected two routines or modules are
Explanation:
Coupling dictates inter-class dependencies. Good OOP design mandates loose coupling.
Correct Answer: b) Using interfaces and dependency injection
Explanation:
By programming to an interface rather than an implementation, components do not depend on exact classes, achieving loose coupling.
Correct Answer: a) A class can have state (instance fields); a traditional interface cannot
Explanation:
Classes hold both state (variables) and behavior (methods), whereas interfaces traditionally define only behavior contracts (and constants).
Correct Answer: b) You attempted to cast an object to a subclass of which it is not an instance
Explanation:
This runtime exception occurs when trying to cast an object reference to a type that is incompatible with the actual runtime object.
Correct Answer: b) Single Inheritance
Explanation:
Java classes support single inheritance (one direct parent) to prevent ambiguity (diamond problem).
Correct Answer: b) Groups related classes and interfaces, providing namespace management and access control
Explanation:
Packages organize code logically, prevent naming collisions, and provide a boundary for package-private access modifiers.
Correct Answer: a) Yes, this is upcasting and forms the basis of polymorphism
Explanation:
Parent p = new Child(); is completely valid because a Child IS-A Parent. It enables writing flexible, reusable code.
Correct Answer: b) No, it requires explicit downcasting, and will fail at runtime if the object isn't actually a subclass instance
Explanation:
Child c = new Parent(); causes a compile error. Child c = (Child) new Parent(); compiles but throws ClassCastException at runtime.
Correct Answer: c) equals(Object obj)
Explanation:
The equals() method is provided by the Object class and is intended to be overridden to compare the state of two objects logically.
Correct Answer: b) '==' checks memory reference equality, whereas 'equals()' is meant to check logical value equality
Explanation:
'==' verifies if two references point to the exact same memory location. equals() checks if the data inside the objects is equivalent (if overridden).
Correct Answer: c) hashCode()
Explanation:
The Java contract requires that if two objects are equal according to equals(), they must have the same hashCode to function properly in Hash-based collections.
Correct Answer: b) toString()
Explanation:
The toString() method is implicitly called when an object is printed or concatenated with a string.
Related Posts

Java Operators MCQs
Java operators are special symbols and keywords used to perform operations on variables and values, governing arithmetic calculations, logical evaluations,…
October 19, 2026By MCQs Generator

Latest Java Arrays MCQs
In Java, an array is a dynamically allocated object used to store a fixed-size sequential collection of elements of the…
October 19, 2026By MCQs Generator

Latest Java Generics MCQs
Java generics introduce compile-time type safety and reusability by allowing classes, interfaces, and methods to operate on parameterized types. Introduced…
October 19, 2026By MCQs Generator








