🔷 1.
Create a class with two fields and a method to print them
Objective: Practice creating a class, constructor, and method.
🔷 2. Create a Student class with fields: name, roll number, and grade. Print their
details using a method.
🔷 3. Demonstrate constructor overloading
Hint: Create multiple constructors in a class with different parameters.
🔷 4. Create a method that calculates the area of a rectangle using this keyword
🔷 5. Show how to use static keyword for a variable and method
Task: Create a counter that increments every time an object is created.
🔷 6. Create a class Car with method startEngine() and another class ElectricCar
that overrides it
Concept: Method overriding (Runtime Polymorphism)
🔷 7. Create a Person class and extend it to a Teacher class
Concept: Inheritance
🔷 8. Show use of super keyword in inheritance
🔷 9. Create a method with the same name but different parameters
Concept: Method overloading (Compile-time Polymorphism)
🔷 10. Create an abstract class Shape with an abstract method area() and extend it
in Circle and Rectangle
🔷 11. Create an interface Animal with method makeSound() and implement it in Dog
and Cat
🔷 12. Difference between abstract class and interface – explain with code
🔷 13. Create a class with private variables and use getters and setters
Concept: Encapsulation
🔷 14. Demonstrate constructor chaining using this()
🔷 15. Show how to use final keyword with variable, method, and class
🔷 16. Create a BankAccount class and show encapsulation using private fields
🔷 17. Create a class with a method that returns this (method chaining)
🔷 18. Create a simple polymorphic program using a base class Vehicle and derived
classes Car, Bike
🔷 19. Show the use of instanceof keyword with base and derived classes
🔷 20. Difference between deep copy and shallow copy in Java (explain with example)
Bonus Conceptual Questions:
🧠 21. What are the 4 pillars of OOP? Explain with examples.
🧠 22. Why do we need abstraction in Java?
🧠 23. What is the difference between overriding and overloading?
🧠 24. Can we create an object of an abstract class? Why or why not?
🧠 25. What happens if we don’t override a method from the interface?