Set up your courses
Pick the courses you're taking and this page shows only those. About 30 seconds.
Code, one block at a time.
Short lessons: predict first, try it in a model, then see why it works.
Start the first lessonNo sign-up. Your progress saves on this device, and you can keep it later with an email.
Know some java already?
Answer about 10 questions and skip the units you know. New to it? Start with the first lesson below.
Your first Java programs
Say exactly what a Java program prints, name the parts of a Java file, tell a compile error from a run-time error, read a javac message, and predict what + does between text and numbers.
Formulas: Your first Java programsVariables and primitive types
Declare and assign variables of the primitive types, predict integer division, remainders, casts, overflow and rounding error, use char codes and constants, and read the compile errors variables cause.
Strings, Math and input
Call methods on strings, slice and search them, compare them with equals and compareTo, use the Math class and random numbers, read input with Scanner, and format numbers for printing.
Decisions
Write boolean conditions, control statements with if, else and else-if chains placed by their braces, combine conditions with &&, || and !, rewrite them with De Morgan's laws, and trace a switch.
Loops
Trace while, for and do-while loops and count their passes, add up and count with accumulators, avoid off-by-one errors, walk a string, read input to a sentinel, nest loops, and use break and continue.
Static methods
Define and call static methods, pass arguments, return values instead of printing them, read the errors javac gives about returns, keep variables local, overload methods, read a stack trace and split a task into small methods.
Arrays
Make arrays, index them from 0 to length − 1, walk through them with for and for-each, find totals, maximums and values, share and copy them as references, pass them to methods, and shift and reverse them in place.
Writing classes
Write classes with fields, constructors and methods, keep fields private behind accessors and mutators, print objects with toString, follow references and null, tell == from equals, and share static members.
ArrayList and wrapper classes
Make and change an ArrayList, store numbers in it through wrapper classes, traverse it and remove elements without skipping any, keep objects in it, and choose between an array and a list.
2D arrays, searching and sorting
Index and traverse 2D arrays row by row and column by column, write linear and binary search, trace selection and insertion sort, compare algorithms by counting steps, and use Arrays.sort and Arrays.binarySearch.
Inheritance, polymorphism and interfaces
Write subclasses with extends and super, override methods and Object's toString and equals, predict which version runs, cast safely, and write abstract classes, interfaces and Comparable.
Exceptions, files and recursion
Read exceptions and stack traces, catch and throw exceptions, handle the checked exception of a missing file, read a text file line by line, and write and trace recursive methods.