Programming in Java
Unit 2: Data Types, Variables & Wrapper Classes
From primitive bytes to wrapper magic — master every data type, variable scope, type casting, and wrapper class method that powers real Java applications.
⏱️ 5 hrs theory + 4 hrs lab | 💰 Earning Potential: ₹5K–₹15K/month | 📝 30 MCQs (Bloom's Mapped)
💼 Jobs this unlocks: Jr Java Developer (₹4–6 LPA) | Backend Intern (₹3–5 LPA) | Freelance Java Projects
Opening Hook — The Data Behind Every Rupee
💳 How Paytm Handles ₹1,00,000 Crore in Digital Payments
Open your Paytm app right now. See that wallet balance — say ₹2,347.50? Internally, Paytm stores it as a double: double balance = 2347.50;. When you tap "Pay ₹50 for chai," the backend calls Double.toString(balance) to display it on screen, and Integer.parseInt(inputAmount) to validate your input. When Paytm checks your phone number length? That's "9876543210".length() returning an int. When it verifies your PIN? Each digit is a char, validated as a boolean.
Every single rupee you see, send, or receive on Paytm went through Java data types. The wallet balance is a double. The transaction ID is a long. The "Payment Successful" flag is a boolean. The UPI PIN is an array of char. And when Paytm wraps these primitives into objects for network transmission? That's Wrapper Classes — Integer, Double, Character, Boolean.
What if YOU built this? What if you understood exactly how Java stores, converts, wraps, and validates every piece of data in a ₹1 lakh crore fintech system? That's exactly what this chapter teaches you.
Learning Outcomes — Bloom's Taxonomy Mapped (12 Outcomes)
| Bloom's Level | Learning Outcome |
|---|---|
| 🔵 Remember | List all 8 primitive data types with their sizes, default values, and ranges |
| 🔵 Remember | Recall all 53 reserved keywords in Java and identify valid/invalid identifiers |
| 🔵 Understand | Explain the difference between widening (implicit) and narrowing (explicit) type conversion with examples |
| 🔵 Understand | Describe the three types of variables — local, instance, and static — and their scopes |
| 🟢 Apply | Write Java programs using type casting to convert between primitive types correctly |
| 🟢 Apply | Use Wrapper classes (Integer, Double, Character, Boolean) for autoboxing, unboxing, parsing, and conversion |
| 🟢 Analyze | Compare access modifiers (public, private, protected, default) and determine appropriate usage in class design |
| 🟢 Analyze | Differentiate between primitive types and their Wrapper class counterparts in terms of memory, nullability, and use in Collections |
| 🟠 Evaluate | Assess when to use int vs long vs BigInteger for Indian financial calculations (Aadhaar numbers, transaction IDs) |
| 🟠 Evaluate | Evaluate the 5 uses of the static keyword and justify when each is appropriate |
| 🟠 Create | Design and build a multi-currency converter application using proper data types, type casting, and wrapper class methods |
| 🟠 Create | Construct a type-safe Java utility class demonstrating all variable scopes, access modifiers, and static members |