START HERE

Today’s goal

Go from an empty folder to a working Java program that you can compile, run, change, and troubleshoot.

By the end of today you can

  • Set up and verify your Java tools
  • Explain bytecode, the JVM, and why Java is portable
  • Write, compile, and run a program from a blank file
  • Print labeled output using variables and text
  • Read a compiler error and fix it calmly

Today’s boundary

Day 1 is intentionally narrow.

  • No keyboard input
  • No decimal numbers or money
  • No if statements
  • No loops
  • No methods other than main
  • No classes/objects/inheritance

Everything today is String, int, println, and the + sign.

1 — GET READY

Prove the tools work first

Before we learn Java, make sure your editor, terminal, compiler, and runtime are working together.

1

Create the learning folder

C:\JavaBasicsCourse\Day01\learning

2

Open it in VS Code

Use File → Open Folder. The folder should appear in the Explorer pane.

3

Open the terminal

Use Terminal → New Terminal. The prompt should point to the same folder.

Check Java

Type this in the terminal.

java -version

Check the compiler

Type this next.

javac -version
Expected result

The course standard is Java 21; the patch number may differ.

openjdk version "21.0.x"
javac 21.0.x
FIRST PROOF

SetupTest.java

Create the file in your learning folder. Type the code yourself.

public class SetupTest {
    public static void main(String[] args) {
        System.out.println("Setup works");
    }
}
Compile
javac SetupTest.java
Run
java SetupTest
Success looks like Setup works in the terminal and a new SetupTest.class file beside the source file.
Setup troubleshooting
  • 'javac' is not recognized — the compiler is not available on PATH.
  • 'java' is not recognized — check the terminal/environment.
  • file not found — the terminal is probably in a different folder.
2 — UNDERSTAND

What just happened?

You wrote source code, compiled it, and ran the result. Here is the mental model to keep.

SourceSetupTest.java
Compilerjavac
BytecodeSetupTest.class
RuntimeJVM
OutputSetup works

Remember this

javac builds. It turns .java source into .class bytecode.

java runs. It launches the class on the JVM.

JDK / JRE / JVM

JDK — the development kit you install.

JRE — the runtime environment and core libraries.

JVM — executes bytecode.

Why Java? The course materials frame Java around portability, automatic memory management, strong typing, and mature tooling for long-lived software.
3 — HELLOJAVA

Make Java do something

Start from a blank file. Type every character. Do not paste.

TYPE
public class HelloJava {
    public static void main(String[] args) {
        System.out.println("Hello, Java!");
    }
}

Save

Save the file as HelloJava.java.

Compile

javac HelloJava.java

Run

java HelloJava
Expected output: Hello, Java!
PREDICT → RUN → OBSERVE

Change the message

Replace "Hello, Java!" with your own message. Compile and run again.

Java file anatomy
  • The file name matches the public class name.
  • Braces mark the class and method blocks.
  • The main method is where execution starts.
  • Statements end with semicolons.
  • Comments are for people; Java ignores them at runtime.
4 — BREAK IT / READ IT / FIX IT

Errors are instructions, not failures

Use the same repair loop every time: name the stage → read the first useful message → find the line → change one thing → save and try again.

BREAK A

Delete the semicolon

System.out.println("Hello, Java!")

Compile. Look for:

'; ' expected

The compiler is pointing you toward a missing semicolon on this line or the line above.

Fix it

Restore the semicolon, save, and compile again.

BREAK B

Change System to system

Compile and look for cannot find symbol.

Java is case-sensitive. Restore System.

BREAK C

Rename the class but not the file

Change the public class name without changing the filename. Compile and observe the name-mismatch message.

Fix it

Make the public class name and file name match exactly, including capitalization.

THE REPAIR LOOP
  1. Name the stage: compile or run?
  2. Read the first useful error.
  3. Locate the file and line number.
  4. Change one thing.
  5. Save and run the same command again.
CHECKPOINT — NO STARTER

ClaimStatusReport

Create ClaimStatusReport.java from a blank file.

  • Create a String for the claim number.
  • Create an int for days open.
  • Print one sentence combining both.
  • Compile and run.
  • Diagnose your first error yourself before asking for help.
Expected output
Claim CLM-TRAIN-1042 has been open for 12 days.
PROTOTYPE CLOSE

What we would build next

The next prototype sections are the guided WelcomeReport, the independent MemberWelcomeReport, and the afternoon MemberBenefitsSummary project.

Those pieces are already specified in your Day 1 materials; this prototype deliberately stops here so we can test the interaction model before expanding it.