1.2 Anatomy of Hello World & Java Syntax
Estimated reading & practice time: ~25 minutes
Learning Objectives
Mental Model & Analogy
Consider a locked bank vault with security clearance. 'public' means anyone with the address can knock on the outer door; 'static' means the door exists immediately without having to build a new building first; 'void' means the door doesn't hand you an item back when opening; and 'main' is the specific master key slot the guard checks.
Core Concept Breakdown
Architecture Diagram
Code Example
public class Main {
public static void main(String[] args) {
/* Print line outputs text and appends a line break.
Print outputs text without a line break. */
System.out.println("Hello, TBLearn Learner!");
System.out.print("Welcome to Java 21");
System.out.println(" - Let's build real projects.");
}
}Line-by-Line Walkthrough
Hello, TBLearn Learner! Welcome to Java 21 - Let's build real projects.
Common Pitfalls & Debugging
Try It Yourself — Java Sandbox
Live ExecutionTask: Modify the code to print a receipt layout: Header with '=== TBLEARN CAFE ===', Item 'Filter Coffee - ₹30', and Footer 'Thank you for visiting!'.
Test Yourself Before Moving Forward
Short, practical questions tied directly to this section. Passing awards Credits toward course discounts and interview packs.
Checkpoint: Hello World & Java Compilation
Verify you understand javac compilation, JVM bytecode execution, and public class naming rules.