java · level 1 · unit 1 · lesson 4
- meet it
- guess first
- your turn
- fix it
- nailed it
Tap a green word if you get lost.
meet it
An is a clue, not a disaster.
An error is Java saying it got stuck. Everyone gets them, even experts. Before running anything, Java tries to your program, which means checking every line. If one line is wrong, nothing runs at all.
The message names the line and the problem. ';' expected means a semicolon is missing. means Java met a name it does not know, often because of a typo.
Java is , so capitals matter. System with a capital S works. Println with a capital P is a stranger, a symbol Java cannot find.
The message tells you which line to look at, so start your search there.
guess first
One capital letter. What happens?
Guess before you run it. Wrong guesses are how you learn, and nothing is marked.
public class Main {
public static void main(String[] args) {
System.out.Println("Hello!");
}
}
your turn
Your turn. Close everything you open.
Type your superpower in place of the blank. Then finish line 3 with a closing quote, a closing bracket and a semicolon, and press run.
output
press run to see what happens
fix it
Breakfast is broken. Can you fix it?
output
press run to see what happens
- Read the error message. Which line does it point to?
- Every error points at line 4. Count the quote marks on that line.
- A string needs a quote at both ends. Add " before Come, then press run.
nailed it
you turned errors into clues. :D
- Errors are clues. Read the message and the line number.
- Java checks the whole program before any of it runs.
- Java is case-sensitive:
printlnworks,Printlndoes not.
new words in your collection
- error
- compile
- symbol
- case-sensitive
This lesson isn’t saved. A free account remembers every lesson you finish.