Course

Java from the ground up

The language that runs almost everywhere

  • Beginner
  • 12 chapters
  • 185 min read

Learn Java by running it: the main method and printing, variables and the primitive types, text and its methods, decisions with if and switch, loops, methods with parameters and return values, arrays, ArrayList and HashMap, classes with fields and constructors, interfaces and a small hierarchy, exceptions, and a capstone that sorts records into a report.

What You'll Learn

  • Write, compile and run a program that starts at main and prints a line
  • Hold values in typed variables, and know what division and casting really do
  • Work with text using length, charAt, substring, case changes and equals
  • Branch with if, else, switch and the ternary form
  • Repeat work with for, while and the enhanced for loop
  • Write static methods with parameters, return values and void
  • Use arrays, Arrays.toString and Arrays.sort
  • Grow and key collections with ArrayList and HashMap
  • Build classes with fields, constructors and methods of your own
  • Implement an interface, extend a class, and let one loop serve both
  • Catch failures with try and catch, and throw your own with a message
  • Assemble a sorted report from a class, a HashMap and a comparator

Prerequisites

  • No programming experience needed — this course starts at the first line
  • Any other language you know will make the early chapters quick

Course Content

  1. 01
    Your first Java program

    What Java is for, the class and the main method every program starts from, and how to print a line of text on the screen.

    Beginner · 12 min read

    Not started
  2. 02
    Variables and the primitive types

    Giving values a name, the primitive types you will use every day, and what really happens when you divide a whole number or cast one.

    Beginner · 14 min read

    Not started
  3. 03
    Text, and the String methods

    Strings are objects, so they come with methods: counting characters, reading one, cutting a piece out — and why == is not equals.

    Beginner · 14 min read

    Not started
  4. 04
    Decisions: if, else and switch

    Comparing values, joining conditions with and, or and not, choosing a path with if and else, and picking one case with switch.

    Beginner · 13 min read

    Not started
  5. 05
    Loops: for, while and the enhanced for

    Repeating work three ways: the counted for loop, the while loop that stops on a condition, and the enhanced for that walks a whole array.

    Intermediate · 15 min read

    Not started
  6. 06
    Methods: parameters and return values

    Naming a piece of work, handing it values, getting an answer back, and why every method so far has been marked static.

    Intermediate · 15 min read

    Not started
  7. 07
    Arrays and the Arrays helper

    One name for many values, indexing from zero, the length that cannot change, and the helper class that makes an array readable.

    Intermediate · 14 min read

    Not started
  8. 08
    ArrayList and HashMap

    Two collections that grow as you need them: a numbered list, and a set of keyed values where a word is the address.

    Intermediate · 16 min read

    Not started
  9. 09
    Classes: fields, constructors and methods

    A type of your own that carries data and the methods that work on it, built with a constructor and used through objects.

    Advanced · 17 min read

    Not started
  10. 10
    Interfaces and a tiny hierarchy

    A promise a class makes to the rest of the program, a class that extends another, and the polymorphism that follows from both.

    Advanced · 18 min read

    Not started
  11. 11
    Exceptions: try, catch and throw

    What happens when something goes wrong, how to catch it and carry on, and how to throw a problem of your own with a reason attached.

    Advanced · 17 min read

    Not started
  12. 12
    Putting it together: a small report

    The whole course in one file: a class for each record, a HashMap to hold them, a sort, and a printed report that anyone can read.

    Advanced · 20 min read

    Not started