Java is the language of Android, of most large company back ends, and of a lot of first-year computer science. This is a working Java, not a quiz about Java: every lesson has a short explanation, a task, and an editor, and Run hands your code to the real Java compiler, running inside your browser tab, then runs the result and checks it. Compile errors come back with the line number, the way they would from any Java tool.
The course goes from printing a line to interfaces, generics, streams, and exceptions, in the order the ideas build on each other. It ends in a project, a small library system, that is not started from nothing: one lesson in most modules builds one of its classes, saved in this browser as you go, and the project compiles them alongside your own code. Forty lessons of ten minutes or so each; you can stop and pick up later.
What you will learn
- Classes, main, static variables, types, and printing
- Conditions, if and else, methods, and switch
- for, while, break, continue, nested loops
- Arrays, ArrayList, sorting, HashMap
- String methods, chars, StringBuilder, parsing, formatting
- Classes, constructors, encapsulation, records, inheritance
- Interfaces, enums, lambdas, generics, streams
- Exceptions, Optional, equals and hashCode, and the project
The final project
The course ends with Project: the library: a library system assembled from the classes you built. 10 of the lessons build a part of it, saved in this browser as you go, so the project is assembled from your own work rather than started from nothing.
Policy(Variables and types) holds the loan length and the daily late fee the library charges.Fees(Methods) works out the late fee for a returned book, capped at ten dollars.Checksum(while loops) adds up the digits of a card number; a valid card sums to a multiple of ten.Search(Arrays) finds the position of a title in the catalog, or -1 when it is not there.Isbn(Characters) checks the check digit of an ISBN-10 before a book is accepted into the catalog.Book(Encapsulation) is a book in the catalog: title, author, ISBN, and whether it is on the shelf.Member(Records) is a library member: a name and a card number.Status(Enums) is the state of a book: available, on loan, or lost.Reports(Streams) counts the books in the catalog per author.LibraryException(Custom and checked exceptions) is what the library throws when a request cannot be honored: unknown book, book out, bad card.