Programming in Java
Unit 9: Abstract Class & Interface
From abstract blueprints to interface contracts — master Java's most powerful abstraction tools, design clean hierarchies, and write code that scales like enterprise software.
⏱️ 6 hrs theory + 4 hrs lab | 💰 Earning Potential: ₹10K–₹30K/month | 📝 30 MCQs (Bloom's Mapped)
💼 Jobs this unlocks: Java Backend Developer (₹5–10 LPA) | API Designer (₹8–15 LPA) | Software Architect (₹15–35 LPA)
Opening Hook — Every Aadhaar Verification Is a Java Interface in Action
🏢 Aadhaar API = Interface — Biometric Verification at Scale
India's Aadhaar system authenticates 1.4 billion identities. But here's the thing — UIDAI doesn't do all verifications itself. Banks like SBI, telecom companies like Jio, and payment apps like Paytm all verify Aadhaar. How? Through the Aadhaar Authentication API — essentially a Java-style interface.
The Aadhaar API defines a contract: any implementing agency MUST provide biometricVerify() and demographicAuth(). It doesn't care HOW each agency implements it internally — SBI uses fingerprint scanners at branches, Jio uses iris scanners at stores, Paytm uses face recognition on phones. The interface guarantees they all follow the same contract.
This is exactly what a Java interface does. It defines WHAT must be done, not HOW. Every bank, every telecom, every fintech — they all implements AadhaarAuth and provide their own implementation. If they miss even one method? Compilation error. Contract violated.
And what about the abstract class? Think of it as a partially-built template. UIDAI might provide a base abstract class AuthProvider with common logging and encryption already implemented, but leave biometricVerify() abstract — forcing each agency to provide their own biometric logic.
Learning Outcomes — 12 Bloom's Taxonomy Mapped
| Bloom's Level | Learning Outcome |
|---|---|
| 🔵 Remember | Define abstract class, abstract method, and interface; list the rules for each |
| 🔵 Remember | State the difference between abstract and interface keywords and list Java 8/9 additions to interfaces |
| 🟢 Understand | Explain why Java does not allow instantiation of abstract classes and why interfaces enable multiple inheritance |
| 🟢 Understand | Describe functional interfaces, marker interfaces, and the interface segregation principle with Indian industry examples |
| 🟡 Apply | Write a Shape abstract class hierarchy with area() and perimeter() methods for Circle and Rectangle |
| 🟡 Apply | Implement a Payable interface with Employee and Freelancer classes and compute payment amounts |
| 🟠 Analyze | Compare abstract class vs interface across 10+ parameters and decide which to use in a given design scenario |
| 🟠 Analyze | Trace the execution of code involving multiple interface implementation and method resolution |
| 🔴 Evaluate | Critique a class design that uses inheritance where interface composition would be better, proposing refactoring |
| 🔴 Evaluate | Assess when the Strategy Pattern using interfaces is preferable to template method using abstract classes |
| 🟣 Create | Design and code a complete Payable system with abstract base, interface contracts, and polymorphic processing |
| 🟣 Create | Build a sorting system using Comparable and Comparator interfaces for custom object ordering |