Name:
Contact No:
Email:
Are you Interested with working us or growing with us? Yes / No
If yes then in which technology?
Java OOP Concepts – Assignment
Part A – Short Answer (Theory)
1. Define each OOP concept with an example from daily life:
• - Encapsulation
• - Inheritance
• - Polymorphism
• - Abstraction
2. Explain how Java supports encapsulation with an example using private, getters, and setters.
3. Describe the difference between compile-time and run-time polymorphism with examples.
4. How is abstraction achieved in Java? Give one real-life analogy.
Part B – Coding Tasks (Implementation)
1. Encapsulation:
Create a class Student with private fields name and rollNo. Add getter and setter methods to access and
modify the values.
2. Inheritance:
Create a superclass Animal with a method sound(). Create a subclass Dog that overrides the sound() method
to print “Dog barks”.
3. Polymorphism:
Write a class Shape with a method area(). Overload the method to calculate the area of a circle and a
rectangle.
4. Abstraction:
Create an abstract class Appliance with an abstract method turnOn(). Extend it with a class Fan that
implements turnOn().
Part C – Critical Thinking
1. Why is OOP preferred in large-scale application development?
2. Give an example of a software or app you use daily and explain how OOP might be applied in its design.