Java OOP Quiz (Object-Oriented Programming)
Test your knowledge by answering the 30 questions below.
1. Which of the following is not an OOP concept in Java?
2. Which keyword is used to inherit from a class in Java?
3. Can you instantiate an abstract class in Java?
4. What is encapsulation?
5. Which method is called automatically when an object is created?
6. Runtime polymorphism in Java is achieved through:
7. Which access modifier makes a member visible only within its own class?
8. What does the 'super' keyword mean?
9. In Java, a class can inherit from:
10. What is an interface in Java?
11. What do we call having multiple methods with the same name but different parameters?
12. Which keyword prevents a class from being inherited?
13. Which keyword is used to access a static member of a class?
14. Which statement is true about the default constructor?
15. What happens if we try to instantiate an interface?
16. The 'this' keyword refers to:
17. Which method is used to compare the content of two objects (e.g., String) instead of their references?
18. All classes in Java implicitly inherit from the class:
19. A class can implement:
20. What is an abstract method?
21. The 'protected' modifier allows access:
22. What is special about static blocks (static { })?
23. How do you call the constructor of the parent class?
24. Can we overload the main() method in Java?
25. The 'instanceof' keyword is used to:
26. Which relationship describes inheritance?
27. What is an anonymous class in Java?
28. A 'final' variable...
29. Which design pattern is often used to ensure a class has only one instance?
30. What is the main difference between an Interface and an Abstract Class (before Java 8)?
Why Master Object-Oriented Programming (OOP) in Java?
Object-Oriented Programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code: data in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods). Java is heavily built around this paradigm, making it essential for any Java developer.
Mastering the four main pillars of OOP—Encapsulation, Inheritance, Polymorphism, and Abstraction—allows developers to write code that is more modular, reusable, and easier to debug. By structuring software around objects that interact with one another, complex systems become much easier to manage, scale, and maintain over time.