0/30 Days Completed 0 Learning Days
Day 15 of 30 · Week 3 — OOPS Fundamentals
What is OOPS?
1 Learn
Object-Oriented Programming (OOP or OOPS) organizes a program around objects — things that have data (fields) and actions (methods).
Think of a Student: data like name and marks, actions like study() or showResult(). OOP models such real things in code.
The four main ideas are Encapsulation, Inheritance, Polymorphism and Abstraction. You will meet each one over the coming days.
OOP makes large programs easier to understand, reuse and change.
2 See the Code
Java
class Phone {
String brand;
int battery;
void call(String name) {
System.out.println(brand + " calling " + name);
}
}
public class Demo {
public static void main(String[] args) {
Phone p = new Phone();
p.brand = "Nova";
p.battery = 80;
p.call("Ravi");
}
}- Phone is a class: a design with data (brand, battery) and an action (call).
- new Phone() creates an object from that design.
- p.call("Ravi") asks the object to do its action.
Output
Nova calling Ravi
3 Practice
- List 3 fields and 2 methods for a real-world object like a Bicycle or a Library Book (on paper is fine).
Try it in your own Java setup or write it in the Practice Notebook.
4 Quick Check
1. In OOP, an object has...
2. Which is NOT one of the four OOP pillars?
Step 5
Answer and check the Quick Check above to unlock this.