100 Java OOPs Multiple Choice
Questions
1. 1. Which of the following is the correct way to create an object in Java?
a) MyClass obj = new MyClass();
b) MyClass obj();
c) MyClass obj = MyClass();
d) object obj = new MyClass();
✅ Answer: a
Explanation: This is the correct syntax to create an object of a class.
2. 2. Which of the following is not a feature of OOP in Java?
a) Inheritance
b) Encapsulation
c) Polymorphism
d) Compilation
✅ Answer: d
Explanation: Compilation is a general programming process, not an OOP concept.
3. 3. Which keyword is used to create a class in Java?
a) object
b) class
c) struct
d) define
✅ Answer: b
Explanation: The `class` keyword is used to declare a class in Java.
4. 4. Which method is the entry point of a Java program?
a) start()
b) run()
c) main()
d) init()
✅ Answer: c
Explanation: `public static void main(String[] args)` is the standard entry point.
5. 5. Which access modifier makes a member visible to all classes?
a) private
b) protected
c) public
d) default
✅ Answer: c
Explanation: `public` gives universal access across packages.
6. 6. Encapsulation is implemented in Java using:
a) Inheritance
b) Abstraction
c) Access Modifiers
d) Packages
✅ Answer: c
Explanation: Encapsulation hides data using private variables and provides access via
public methods.
7. 7. Which access modifier prevents data from being accessed outside a class?
a) protected
b) private
c) public
d) default
✅ Answer: b
Explanation: `private` restricts access to the defining class only.
8. 8. Which of the following best describes encapsulation?
a) Wrapping data and code together
b) Inheriting features from base class
c) Overriding methods
d) Using interfaces
✅ Answer: a
Explanation: Encapsulation means bundling data and methods into a single unit (class).
9. 9. Which keyword is used for inheritance in Java?
a) extends
b) implements
c) inherits
d) super
✅ Answer: a
Explanation: `extends` is used for class inheritance.
10. 10. Which class is the superclass of all classes in Java?
a) Object
b) Base
c) Root
d) Parent
✅ Answer: a
Explanation: `Object` is the root class in Java.
11. 11. Java supports multiple inheritance through:
a) Abstract classes
b) Classes
c) Interfaces
d) Constructors
✅ Answer: c
Explanation: Java does not support multiple class inheritance but supports multiple
interface inheritance.
12. 12. What does the `super` keyword do?
a) Calls a method in the subclass
b) Refers to the superclass object
c) Refers to the main method
d) None of the above
✅ Answer: b
Explanation: `super` refers to the immediate superclass.
13. 13. Polymorphism allows:
a) Methods with the same name but different implementations
b) Multiple main methods
c) Private variables
d) One class inside another
✅ Answer: a
Explanation: Polymorphism means 'many forms', such as method overloading and
overriding.
14. 14. Method overloading is an example of:
a) Runtime polymorphism
b) Compile-time polymorphism
c) Encapsulation
d) Inheritance
✅ Answer: b
Explanation: Overloading is resolved at compile time.
15. 15. Which of the following is required for method overriding?
a) Same name, same parameters
b) Different name, different parameters
c) Same name, different class
d) a and c
✅ Answer: d
Explanation: Overriding occurs in subclass with same method signature.