Using the standard library
Math, String and List come with every JDK. You didn't write them, and you don't install anything extra to use them.
Java is a programming language plus a platform to run it. The javac compiler turns your .java files into portable bytecode (.class files), and a Java Virtual Machine on each computer runs that same bytecode, which is why one compiled program works on Windows, macOS and Linux. The JDK is the toolbox for writing Java; the JVM is the engine that runs it.
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 with two classes in one file: a Calculator class with a method that doubles a number, and Main, which prints the double of 21.
Write a program that uses Math.max, Math.min and Math.abs from the standard library and prints the results for 8 and -3.
Write a program that prints Integer.MAX_VALUE and Long.MAX_VALUE, each on its own line.
Explain it without notes
Explain the difference between the JDK, the JRE and the JVM.
What is bytecode, and why doesn't Java compile straight to machine code?
How does Java achieve "write once, run anywhere", and where does that promise stop?
What is OpenJDK, and why are there several JDK distributions?
Expected output
Square root of 81: 9.0
Bigger of 7 and 12: 12
Shout: JAVA
Fruits: [mango, apple]