Continuum

The complete course

Learn Java as one connected system.

The order matters. Each phase establishes the model used by the next: values before objects, identity before collections, execution before concurrency. Follow the path in order if this is your first serious Java course.

Begin with lesson 1.1
14 phases57 lessons235 exercises20 hours of reading
  1. I

    Phase I

    The Machine

    What Java is, and what is actually running your code.

    1. 1.1Why Java ExistsStart with the portability problem Java was designed to solve, then trace source code to the processor.16 min
    2. 1.2JVM, JRE, JDK, and Your First ProgramBuild and run one Java file from the terminal, then follow it through the runtime.18 min
  2. II

    Phase II

    Data and Memory

    Trace a Java value from source literal to bits, arithmetic, conversion, and output.

    1. 2.1Variables, Types, Literals, KeywordsGive a value a name, declare what that name can hold, and let the compiler check each use before the program runs.22 min
    2. 2.2How Numbers Live in MemoryFixed-width two's complement represents signed integers. IEEE 754 represents binary floating point, including rounding and special values.26 min
    3. 2.3Type Conversion, Promotion, CastingFollow the source type, the conversion rule, and the expression type to predict what Java keeps and what it loses.24 min
  3. III

    Phase III

    Logic and Flow

    Making a program compute, decide, and repeat.

    1. 3.1OperatorsCalculate values, compare them, short-circuit boolean expressions, and manipulate fixed-width bit patterns.20 min
    2. 3.2ConditionalsBoolean branches, braces, ordered tests, and switch statements and expressions without hidden fallthrough.18 min
    3. 3.3Loops and Jump StatementsChoose a loop from its condition, trace its execution order, and prove that each pass makes progress toward stopping.17 min
  4. IV

    Phase IV

    Data in Rows

    Fixed-length indexed data, array references, traversal, aliasing, and copying.

    1. 4.1ArraysFixed-length indexed data, default values, references, copying, and arrays whose rows can have different lengths.19 min
    2. 4.2How Arrays WorkConstant-time indexed access, opaque references, bounds checks, and the implementation details Java deliberately hides.20 min
  5. V

    Phase V

    Methods

    Giving work a name, and the stack that makes it possible.

    1. 5.1Methods, Calls, Recursion, and OverloadingLearn methods from the first call to overload resolution, with the call stack connecting every step.28 min
  6. VI

    Phase VI

    Objects

    Define reference types, construct valid objects, and trace identity, calls, and copying.

    1. 6.1Classes, Objects, and `new`A class defines a type with state and behaviour. Each object is one instance of that type, with its own fields.20 min
    2. 6.2Constructors, Chaining, `this`Constructors establish an object's starting state. Chaining keeps that work and its validation on one path.20 min
    3. 6.3Objects in Memory: Size, Copying, PassingReference values explain aliasing, argument passing, copying, and why measured object size depends on the JVM.22 min
    4. 6.4`static` and `final`Static members belong to a class-level context. Final restricts reassignment, overriding, or inheritance, depending on where it appears.21 min
  7. VII

    Phase VII

    The Four Pillars

    Closing objects off, building on them, and letting them choose their own behaviour.

    1. 7.1Encapsulation, Inheritance, Packages, and `super`Protect an object's rules, then share a genuine parent type without losing control of construction.28 min
    2. 7.2Abstraction, Polymorphism, Abstract Classes, and InterfacesProgram to a shared contract while each object keeps its own implementation.30 min
    3. 7.3Wrapper Types, Autoboxing, and POJOsSee every hidden primitive conversion, avoid identity and null traps, and separate Java objects from framework rules.26 min
    4. 7.4Static Nested, Inner, Local, and Anonymous ClassesChoose the right nesting form by asking about scope, the enclosing object, and captured values.29 min
  8. VIII

    Phase VIII

    Identity and Contracts

    Teaching Java what "the same" means, and what happens when you get it wrong.

    1. 8.1Java I/O: Streams, Scanner, BufferedReaderYou have been using `Scanner` since Phase I without being told what it is. Here is the machine underneath it, and why reading one byte at a time is a thousand times slower than it needs to be.19 min
    2. 8.2Immutable ClassesAn object that can never change is safe to share with anyone, forever, with no locks and no copies. Getting there takes four steps, and `final` is only the first one.17 min
    3. 8.3The Object Class: `equals`, `hashCode`, `toString`Every class you have ever written already extends one class you never mentioned. Three of its methods decide whether your objects can be compared, printed, or found again, and getting one of them wrong makes data disappear.24 min
    4. 8.4EnumsA type with a fixed set of named values, where the compiler refuses to let you invent a new one. It is the only place in Java where the compiler will tell you that you forgot a case.18 min
    5. 8.5Interfaces Deep DiveDefault methods, static methods, marker interfaces, and the one that changes everything: an interface with exactly one method left to implement.20 min
  9. IX

    Phase IX

    Text and Types

    The type you use most, and the trick that lets one class work with any type.

    1. 9.1Strings: The Pool and ImmutabilityA String is a character array with a wrapper around it. Two design choices make it behave unlike anything else in Java, and they finally explain the == answer that surprised you in Phase III.19 min
    2. 9.2String Methods and StringBuilderFifty methods you do not need to memorise, and one class you do. Joining text in a loop is the commonest slow thing in beginner Java, and the fix is one line.17 min
    3. 9.3GenericsOne class that works with any type, without giving up type checking. Before generics you used Object and a cast, and the cast failed while the program was running.20 min
    4. 9.4Wildcards: `extends` and `super`A Dog is an Animal, but a List of Dogs is not a List of Animals. That refusal protects you, and wildcards are how you work around it without losing the protection.18 min
  10. X

    Phase X

    The Collections Framework

    Different ways to store data, and when each one makes sense.

    1. 10.1The Collections FrameworkEach way of storing data makes some jobs quick and others costly. Java gives you several choices behind shared interfaces, so you can switch when your program needs something different.19 min
    2. 10.2Iterable and the IteratorThe for-each loop is not a loop. It is one interface with one method, and it is why the same line works on an array, a list, a set and a map.18 min
    3. 10.3The Collection InterfaceThe dozen methods every collection in Java has, and the rule that decides which methods live here rather than in List or Set.16 min
    4. 10.4List: ArrayList, LinkedList, Vector, StackFour classes implement List. You should use two of them. Java keeps the other two because deleting them would break code written in 1997.19 min
    5. 10.5Set and Map: Inside HashMapFinding a value in a million without searching. This is the section every earlier phase has been feeding, and your own hashCode is what makes it work.24 min
    6. 10.6Map Methods, EnumMap, and the Rest of the FamilyThe methods you will actually call, plus four specialised maps. Two are worth knowing, one has a single use, and one Java would delete if it could.18 min
    7. 10.7Queue, Deque, and PriorityQueueWho is served next? A print queue answers "whoever arrived first". A hospital answers "whoever is most urgent". Both are queues, and the second one is a tree hiding inside an array.18 min
    8. 10.8Comparable, Comparator, and SortingThree sections have deferred the same question. Java can sort Integers and Strings on its own, and it has no idea which of two Students comes first until you tell it.20 min
  11. XI

    Phase XI

    Functional Java

    You have been writing lambdas since Phase X without being told what they are.

    1. 11.1Lambdas and Functional InterfacesYou want to tell a method how to do a job. Java only lets you pass variables, so for twenty years you wrapped the job in a class. This is the phase where you stop.20 min
    2. 11.2Method References and the Four ShapesJava ships forty functional interfaces and you need four of them. Learn those four, learn the two colons, and most functional code stops looking like a new language.21 min
    3. 11.3Streams, and When the Work HappensA stream is not a collection. It is a description of work that has not started yet, and knowing exactly when it starts explains almost everything surprising about them.20 min
    4. 11.4The Operations, and What collect Really DoesThirty methods split cleanly in two. Does it hand back a stream, or an answer. Once you sort them by that question, the list stops being a list to memorise.21 min
    5. 11.5Optional, and the Habit It Is Trying to BreakA method that might not find anything has to say so somehow. Returning null says it in a way the compiler cannot see, and that is the whole problem.19 min
    6. 11.6Parallel Streams and the Primitive OnesOne word splits your work across every core in the machine. The same word makes small jobs four times slower and can silently lose most of your data.20 min
  12. XII

    Phase XII

    When Things Go Wrong

    Every method you have written so far assumed everything works.

    1. 12.1Exceptions, Errors, and the Stack TraceA method that fails has to tell the one that called it. Returning a value cannot do that job, so Java unwinds the call stack instead, and the wall of text it prints is a map of exactly how it got there.20 min
    2. 12.2Checked, Unchecked, and Exceptions of Your OwnTwo things can fail the same way and the compiler treats them completely differently. The rule is real, the reasoning behind it is contested, and every language designed after Java went the other way.21 min
  13. XIII

    Phase XIII

    Memory and the Garbage Collector

    Three phases have argued about the heap. This is where you find out what it costs.

    1. 13.1Where Everything Actually LivesYou have been told since Phase IV that locals live on the stack and objects live on the heap. Both halves are true and neither is the whole picture, and the two areas nobody mentions are where your classes and your string literals are.20 min
    2. 13.2What Makes an Object GarbageNobody frees anything, and a program running alongside yours decides which of your objects are still needed. The rule it uses is not the obvious one, and knowing the real rule is what lets you find a leak in a language that has no free.21 min
  14. XIV

    Phase XIV

    Concurrency

    The phase where your code stops being wrong in ways you can reproduce.

    1. 14.1What a Thread Actually IsYour single threaded program has six threads in it and always has. This section is about what each one owns, what they all share, and why that one split makes everything after it hard.19 min
    2. 14.2Two Ways to Make One, and Six StatesExtending Thread and implementing Runnable both work, and one of them spends your only superclass. Then six states, three of which mean a thread is not running for three different reasons.19 min
    3. 14.3Asking a Thread to StopThere is no method that stops a thread, and the one that used to has been made to throw. What replaced it is a request the thread has to agree to, and the way it agrees is easy to get wrong by accident.19 min
    4. 14.4Three Ways Two Threads Break One FieldYou expect 200,000 and get 123,267. Then 115,782. Then 111,996. Nothing throws, the code looks right, and there are three separate problems here rather than one.22 min
    5. 14.5The Lock Every Object Already HasOne keyword fixes all three failures from the last section. The thing it locks is not obvious, and two methods that both say synchronized can be locking completely different objects and protecting nothing.21 min
    6. 14.6Waiting for Something to HappenA lock makes threads take turns. It gives one no way to tell another that the thing it was waiting for has arrived. That needs two more methods, and one rule that looks like a typo.20 min
    7. 14.7Locks You Can Give Up OnEverything synchronized cannot do, in one package. Try and give up, wait with a deadline, be interrupted, let many readers in at once. The last one is the famous optimisation and it made things seventeen times slower until the reads got long enough.21 min
    8. 14.8Counting Without a LockOne processor instruction reads, compares and writes as a single unbreakable step. Every lock in the last section is built on it, and using it directly fixes the counter with no waiting at all. It is also slower than a lock once eight threads want it.20 min
    9. 14.9The Value Came BackCompare-and-swap asks whether the value is still what you read. Something can change and change back, the comparison succeeds, and everything you concluded from it is wrong. Reading the code more carefully will not help.19 min
    10. 14.10Stop Making ThreadsA thread costs a megabyte, runs once, returns nothing and loses its failures. A pool fixes all four, and the factory method everyone uses to build one has a queue that will accept two billion tasks before it complains.21 min
    11. 14.11Futures That Do Not Block, and Threads That Are Nearly FreeThe machine gave up at 2,027 platform threads. It ran a million virtual ones in three seconds. The last section of the course is also the one that quietly removes the reason for the previous one.22 min