Lesson 7 of 34 · Fundamentals
Quiz: Java Fundamentals
Time to check what you've learned in the Fundamentals chapter: Java's primitive types, integer vs decimal math, Strings and their methods, decisions with if and switch, and loops.
Read each question carefully — several of them are the classic traps that catch even experienced developers coming to Java from other languages. If you miss one, the explanation shows you why, and you can revisit the lesson before facing the chapter boss.
What this quiz covers
The questions check what you learned in the Fundamentals chapter of Learn Java. Not sure about a topic? Review its lesson first:
- Java Hello World: Your First Program
Write your first Java program: the Main class, the main method and System.out.println. Compile and run real Java in your browser — no JDK install.
- Java Variables and Primitive Data Types
Learn how to declare Java variables, the 8 primitive types (int, double, boolean, char…), String, var and final constants — then practise in your browser.
- Java Operators: Integer vs Double Math
Master Java arithmetic: + - * / %, integer division, casting, compound assignment and the Math class. Practise with interactive exercises in your browser.
- Java Strings and String Methods
Learn Java Strings: concatenation, length, charAt, substring, indexOf, toUpperCase, trim and why you compare Strings with equals(), not ==.
- Java if/else and switch Statements
Make decisions in Java with if, else if and else, logical operators, the ternary operator and modern switch expressions. Interactive exercises included.
- Java Loops: for, while and do-while
Repeat code with Java for, while and do-while loops, use break and continue, loop over the characters of a String and avoid off-by-one errors.
Keep learning
Need a quick reminder? The Java cheat sheet has every topic of Learn Java on one page.
Lesson last updated on .