Programming in Java

Unit 6: OOP — Classes, Objects & Constructors

From blueprint to living object — master classes, constructors, method overloading, and the this keyword to build real-world Java applications.

⏱️ Time: 7 hrs theory + 5 hrs lab  |  💰 Earning: ₹8K–₹25K/month  |  📝 30 MCQs (Bloom's Mapped)

💼 Jobs: Java Developer (₹4–8 LPA)  |  Android Developer (₹5–10 LPA)  |  Backend Engineer (₹6–12 LPA)

Section A

Opening Hook — Every Zomato Order Is an Object

🍕 When You Tap "Order Now," Java Creates an Object

Every time you place a Zomato order, a Java object springs to life. It has fields: orderId, restaurant, items[], status, deliveryAddress. It has methods: placeOrder(), cancelOrder(), trackDelivery(). When you tap "Order Now," the backend calls new ZomatoOrder() — a constructor fires, initialises every field, and the status changes from CREATED → PLACED → PREPARING → OUT_FOR_DELIVERY → DELIVERED.

Zomato's backend runs on Java microservices processing 2 million+ orders per day. Each order = 1 object. Each restaurant = 1 object. Each delivery partner = 1 object. At peak hours during IPL nights, Zomato creates 40,000+ order objects per minute. OOP isn't abstract textbook theory — it's the architecture of every app on your phone.

What if YOU had built this? What if you could design a ZomatoOrder class with constructors, methods, and proper encapsulation? That's exactly what this chapter teaches you — from blueprint to living, breathing Java objects.

🇮🇳 Zomato🇮🇳 Flipkart🇮🇳 Ola🇮🇳 Swiggy🇮🇳 Paytm🇮🇳 PhonePe
Java powers 3 billion+ devices worldwide. 90% of Fortune 500 companies use Java for backend systems. India has 12 million+ Java developers — the largest Java developer community in the world. Every Android app, every banking NEFT/RTGS transaction, every Aadhaar authentication runs on Java. Learning OOP in Java isn't just academics — it's your career ticket.
Section B

Learning Outcomes — Bloom's Taxonomy Mapped

Bloom's LevelLearning Outcome
🔵 RememberDefine class, object, constructor, method, and the this keyword with correct Java syntax
🔵 RememberList the 5 uses of the this keyword and 3 types of constructors in Java
🔵 UnderstandExplain the difference between class and object using the DDA flat blueprint analogy
🔵 UnderstandDescribe how constructor chaining works using this() and super()
🟢 ApplyWrite a BankAccount class with parameterized constructor, deposit(), withdraw(), and getBalance()
🟢 ApplyImplement constructor overloading with default, parameterized, and copy constructors
🟢 AnalyzeDifferentiate between instance methods and static methods with real code examples
🟢 AnalyzeCompare method overloading vs method overriding (preview for Unit 7)
🟠 EvaluateDebug constructor chaining errors and predict output of complex this() calls
🟠 EvaluateAssess when to use static methods vs instance methods in application design
🟠 CreateDesign a complete ZomatoOrder class with multiple constructors and business logic methods
🟠 CreateBuild a StudentRecord management system with proper OOP encapsulation