A name card made of text
Programs can draw simple pictures with characters. Every line is one println.
Install a free JDK (Eclipse Temurin), check it with java -version and javac -version, then write Main.java, compile it with javac Main.java and run it with java Main. Since Java 11 you can also skip the separate compile step and run java Main.java directly.
Change the code and press Run (Ctrl+Enter). Try to predict the output first, then break it on purpose and read the error. Your edits are saved and match the lesson page.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Write a program that prints a three-line greeting: your name, your favourite food, and your favourite colour.
Write a program that prints the word Java on one line using four separate System.out.print calls, one letter each, then ends the line.
Write a program that draws a small triangle of stars, three lines high (*, **, ***).
Explain it without notes
What is the difference between javac Main.java, java Main and java Main.java?
What are PATH and JAVA_HOME, and why does Java need them?
Why must the file holding public class Main be named Main.java?
You ran java -version and got 17, but you installed 21. What is going on and how do you fix it?
Expected output
+-----------------+
| Name: Ravi |
| Age: 11 |
| Likes: chess |
+-----------------+