Series 1: Java Foundations

Variables, types, expressions, conditionals, loops, and methods — the building blocks of every Java program.

Lessons

1.1: Welcome to Java

~15 min · Week 1 · No prerequisites

From Python to Java — your first compiled program. The JVM, javac, main method, and why static typing changes everything.


1.2: Variables and Types

~18 min · Week 1 · Prereq: Lesson 1.1

Primitive types (int, double, boolean, char), Scanner input, String basics, and integer division. In Python you wrote x = 5. In Java you declare the type.


1.3: Branching Logic

~17 min · Week 3 · Prereq: Lesson 1.2

if/else, switch, boolean expressions, and comparison operators. Python uses elif — Java uses else if (two words) and needs {} braces.


1.4: Loops

~18 min · Week 4 · Prereq: Lesson 1.3

for, while, and do-while loops. Loop tracing, choosing the right loop type, and the classic fencepost pattern. Python’s for x in range(10) becomes for (int i = 0; i < 10; i++).


1.5: Methods

~20 min · Week 5 · Prereq: Lesson 1.4

Method anatomy, parameters, return types, the call stack, overloading, and decomposition. The method signature is a type contract that Python never required.


1.6: Expressions and Operators

~20 min · Week 2 · Prereq: Lesson 1.2

Operator precedence, type promotion, explicit casting, compound assignment (+=, ++), the string concatenation trap, and floating-point precision. Why 10 / 4 gives 2 and 0.1 + 0.2 != 0.3.


1.7: Strings in Depth

~18 min · Week 2 · Prereq: Lessons 1.2, 1.6

charAt(), substring(), indexOf(), equals() vs ==, and string immutability. The #1 bug in CS1 Java courses — and how to avoid it.


1.8: Scanner Patterns

~16 min · Week 2 · Prereq: Lesson 1.2

The Scanner buffer trap, hasNextInt() validation, next() vs nextLine(), and variable scope with conditionals. Building robust input programs.


1.9: Complex Conditionals

~18 min · Week 3 · Prereq: Lessons 1.3, 1.7

Compound conditions with &&, ||, !. De Morgan’s Laws, the short-circuit guard pattern, range checking, and the ternary operator.


1.10: Loop Patterns and Debugging

~20 min · Week 4 · Prereq: Lesson 1.4

The six essential loop patterns (counter, sum, product, max, min, flag), do-while for input validation, the fencepost problem, and the five most common loop bugs.


1.11: Method Design Patterns

~18 min · Week 5 · Prereq: Lesson 1.5

Top-down design, stub methods, overloading, scope isolation, and Javadoc. The art of breaking programs into small, focused, testable methods.


1.12: Midterm Review and Synthesis

~22 min · Week 5 · Prereq: All previous lessons

Connecting Weeks 1–5: code tracing, call-stack tracing, method writing, and combined problems. The three comparison rules and the complete toolkit.


1.13: Switch Statements and the Ternary Operator

~16 min · Week 3 · Prereq: Lesson 1.3

Traditional switch with break, modern arrow syntax, switch expressions, fall-through, and the ternary operator for concise conditional assignments.


1.14: Nested Loops

~18 min · Week 4 · Prereq: Lesson 1.4

Loops inside loops — star patterns, multiplication tables, triangle patterns. Tracing nested loops step by step and counting total iterations.


Next series: Series 2: Arrays & Algorithms →