Beginner to Pro · 34 lessons · Free

Java: Zero to Hero

Bite-sized lessons of 5–10 minutes. Run the examples, crush the challenge, stack up XP: one lesson at a time, from beginner to pro.

Java progress0/34 lessons
Start learning, it's free
What is Java? Read the beginner's guide →Want to write your own code? Open the Java compiler →
  1. MODULE 1

    Java Basics

    First program, variables, data types, Scanner input, operators and strings

    1. 1. Your First Java Programclass, main() and System.out.println()
    2. 2. Variables and Data Typesint, double, boolean, char and String
    3. 3. Reading Input with ScannernextInt(), nextDouble(), next() and nextLine()
    4. 4. Operators: Doing Maths+ - * / %, integer division and casting
    5. 5. Working with Stringslength(), toUpperCase(), charAt(), substring() and equals()
  2. MODULE 2

    Making Decisions: Conditions

    if, else if, &&, ||, the ternary operator and switch

    1. 1. if and else: Making DecisionsComparison operators with if / else
    2. 2. else if: Many ChoicesCheck several conditions in order
    3. 3. &&, || and !: Combining ConditionsAND, OR, NOT and the ternary operator
    4. 4. switch: Choosing Between Many Valuesswitch, case, break and default
  3. MODULE 3

    Repeating Things: Loops

    for, while, do-while, break, continue and patterns

    1. 1. The for LoopRepeat work a set number of times
    2. 2. while and do-while LoopsLoop when you don't know how many times
    3. 3. break and continueStop a loop early or skip a round
    4. 4. Nested Loops: Star PatternsLoops inside loops and interview pattern questions
  4. MODULE 4

    Arrays and ArrayList

    Arrays, array algorithms, ArrayList and 2D arrays

    1. 1. Arrays: Many Values TogetherCreate arrays, use indexes, length and for-each
    2. 2. Array Algorithms: Reverse, Search, SortThe Arrays class, linear search, reversing and sorting
    3. 3. ArrayList: A List That Growsadd, get, set, remove, size and contains
    4. 4. 2D Arrays: MatricesTables with rows and columns
  5. MODULE 5

    Methods

    Parameters, return values, overloading and recursion

    1. 1. Methods: Reusable CodeWrite and call static methods with parameters
    2. 2. Return ValuesMethods that give back a value
    3. 3. Method OverloadingSame name, different parameters
    4. 4. Recursion: Methods That Call ThemselvesBase case, recursive case and Fibonacci
  6. MODULE 6

    Strings in Depth

    String problems, StringBuilder, characters and ASCII

    1. 1. String Problems: Reverse, Palindrome, CountThe string questions interviews ask most
    2. 2. StringBuilder: Building Strings Fastappend, insert, reverse, delete and split()
    3. 3. Characters and ASCIIchar arithmetic and counting frequencies
  7. MODULE 7

    Object-Oriented Programming (OOP)

    Classes, constructors, encapsulation, inheritance, polymorphism, interfaces and static

    1. 1. Classes and ObjectsA class is a blueprint, an object is the real thing
    2. 2. Constructors and thisSet an object's values as it is created
    3. 3. Encapsulation: private, Getters and SettersProtect data and allow changes only the right way
    4. 4. Inheritance: extends and superOne class reusing another's features
    5. 5. Polymorphism, Abstract Classes and InterfacesOne call, different behaviour
    6. 6. static and finalWhat belongs to the class vs to each object
  8. MODULE 8

    Exceptions and Collections

    try/catch, HashMap, sorting, lambdas, streams and a mini project

    1. 1. Exceptions: Handling Errorstry, catch, finally and throw
    2. 2. HashMap: Key-Value Storageput, get, getOrDefault, containsKey and entrySet
    3. 3. Sorting, Comparators and LambdasSort objects any way you like
    4. 4. Mini Project: Library ManagementClasses, ArrayList, HashMap and exceptions together