Why learn Java?
Java is a widely used, platform-independent programming language. Thanks to the Java Virtual Machine (JVM), the same Java program can run on websites, phones, and video game consoles. People use Java to build mobile apps, music-mixing software, money management systems, and games.
Your first Java program
The lines beginning with public define the structure of the program. The two lines beginning with System are the sequence of steps the program completes — one at a time, in order. That's called sequencing.
🧠 Quick check
Before a Java program can run, a compiler translates the code into machine code and checks it for errors. What do you think happens if the compiler finds a mistake?
Vocabulary flashcards
Click a card to flip it. Use the arrows to move through the deck — say the definition out loud before you flip!
Click a term, then click its definition. Match all 8 to unlock the next section.
Anatomy of a Java program
This program has 5 important parts. Click each highlighted line or symbol in the code to reveal what it does. Find all 5!
0 / 5 discovered
🔑 The rules you just discovered
- The class name must match the file name:
public class Welcome→Welcome.java public static void main(String[] args)is the main method — the entry point. The JVM finds it and starts there.- Curly braces
{ }mark a block of code. Every open brace needs a matching close brace. - Every statement ends with a semicolon
; - A method is a named block of code that only runs when it is called.
Errors in programs are called bugs, and fixing them is called debugging. This program HelloPLTW.java has 4 bugs. Read the compiler error, then click the line that contains the bug.
print vs. println
System.out.println moves the cursor to a new line after printing. System.out.print stays on the same line. And inside quotes, escape sequences \n (new line), \" (double quote), and \\ (backslash) have special meanings.
🔬 Predict the output
How many lines of output will this print?
Print Lab: make the smiley
Build a program line-by-line to produce exactly this output (this is the real Activity 1.1.1 challenge!):
Rules: use print at least twice, println at least twice, and all three escape sequences (\n, \", \\).
Show what you know
Answer all 8 questions, then click Grade my exit ticket. You can retry once to improve your score.
📝 Computer Science Notebook
Before you leave, add these to your notebook — you'll use them all year:
- Sequencing defines an order for when steps in a process are completed — one at a time.
- A compiler checks code for some errors; those errors must be fixed before the program can run.
- A syntax error breaks the rules of the language and is detected by the compiler.
- A method is a named block of code that only runs when it is called; a block of code is any code in braces.
- A string literal is characters in double quotes; a literal is the code representation of a fixed value.
- Escape sequences
\",\\, and\nstart with\and have special meaning in Java.