Programming · course 19 of 105
Java: Know the Output Before You Run It
Read small Java programs and say exactly what they print, that they throw, or that they won’t compile: division, strings, loops, arrays, methods, objects and four common exceptions.
Not on sale yet. When sales open: $4.99 USD for this course, paid once, or every course for $9.99 USD a month. Prices
$4.99 USD, paid once. Or every course for $9.99 USD a month until you cancel; try it free for 7 days first (email only, no card, ends on its own). Tax added at checkout where it applies.
Runs in Claude (claude.ai, the Claude apps or Claude Code) with your own Claude account. A course opens there as soon as your payment goes through; nothing is shipped.
Preview
What it teaches
Reading small Java programs and saying exactly what they print, or that they stop with an exception, or that they won’t compile. Whole-number division (7 / 2 is 3, -7 / 2 is -3), + with text (1 + 2 + "3" against "1" + 2 + 3), char and int arithmetic, int overflow and the "lossy conversion" compile error; if / else if chains against separate ifs, for and while loops and where a loop variable lives; arrays (index 0, one past the end, two names for one array); passing to methods (a copy of an int, the same array); objects, == against equals, constructors and this; and four common exceptions (NumberFormatException, NullPointerException, ArithmeticException, ArrayIndexOutOfBoundsException). The AI asks 3 questions, places you, shows a short card per module (quoted from Oracle’s Java docs, plus examples it really ran), then gives you one small program at a time and names the slip when it’s one of the common ones.
It is a reading-and-predicting course: it has no write-the-code items, and it can’t debug your own program.
How long
34 items (10 concept questions and 24 programs). About 12-35 rounds for a confident student up to about 50-65 for a beginner, plus a 12-item final: 1-3 sessions (estimate, not timed with a real student; simulated students took 12-17 rounds as confident students and 54 as a beginner). The tutor gives a one-line save code at the end of each session.
The modules
4 modules, drilled one item at a time.
- M0
The words
Java’s rules in words: declaring variables, int, integer division, strings, arrays, local variables, exceptions, passing to methods
- M1
Values, division and text
Predict the output: whole-number division, + with text, int and char arithmetic, overflow and the lossy-conversion compile error
- M2
Decisions, loops and arrays
Predict the output: if / else if chains, loops, where a loop variable lives, arrays and one past the end
- M3
Methods, objects and exceptions
Predict the output: passing to methods, objects, == against equals, and the exceptions that stop a program
Before it teaches, it asks
- 1What do you want Java for (a class, Android, a job, curiosity), and have you written code before in any language?
- 2What does this print? If it stops with an exception, name it. If it won’t compile, say so. (The lines run inside main.)int a = 7;int b = 2;System.out.println(a / b);
- 3What does this print? If it stops with an exception, name it. If it won’t compile, say so. (The lines run inside main.)int[] a = {4, 8, 15, 16};System.out.println(a[1] + a[2]);
What’s exact, and what isn’t
Show
Straight from the course’s own notes.
- Keys are checked by running
- Every key that is program output is what the program really printed when a script compiled it with javac and ran it with java on OpenJDK 27 (java -version: openjdk version “27” 2026-09-15, OpenJDK Runtime Environment Homebrew (build 27), OpenJDK 64-Bit Server VM Homebrew (build 27, mixed mode, sharing); javac 27). A Key for an exception is the printed lines, then Exception: <name> from Java’s own error text; Compile error is checked by javac really refusing the code. Each key is also written by hand first and must match the run, or the script fails. Not run on any other Java version.
- Wrong answers are run too
- All 24 listed wrong answers differ from their key, and for each one a script ran a variant of the program (the code the slip pictures, e.g. double instead of int) and checked that it really prints that wrong answer.
- Numbers in the working lines
- A script fails if a working line or a wrong-answer note contains a number that isn’t in the item’s code, its key, a value Java printed for a probe or trace program, or Java’s own error message.
- Quotes
- Every card quote and every M0 Answer is built from sentences quoted word for word from 16 saved pages (11 Oracle Java Tutorials pages, the Java Language Specification SE 21 chapter 15 and four Java SE 21 API pages, all docs.oracle.com, read 2026-10-13). A script checks each quote on its saved copy and fails if one is missing; it does not re-fetch the live pages. The M0 Answers are also checked loosely by script (each longer word must occur in that answer’s quotes). Card lines marked “Run:” show output that the script got by running the code; the short labels and the sentence “the division is done first, then the result is stored” are the course’s own words.
- Honest limits
- The Java Language Specification chapter and the four API pages are the Java SE 21 editions, each of the 11 Java Tutorials pages says “The Java Tutorials have been written for JDK 8.”, and the keys come from OpenJDK 27; the course doesn’t compare them line by line, and the tutor grades against the keys. The AI tutor judges what the student types; no code is run by the course while you learn. The saved text of the Oracle pages carries Oracle’s copyright notice (the Java Language Specification chapter’s has none) and none states an open licence; the course quotes single sentences with the source named.
- Not in it yet
- Write-the-code items, ArrayList and other library classes, Scanner and input, try / catch, switch, inheritance and interfaces, static and final in depth, generics, lambdas.