Java · Beginner

Java Fundamentals

Learn Java from zero: variables, decisions, loops, methods, classes and collections: the foundation for building Android apps with Java.

Units
5
Lessons
20
Practice questions
67
Minutes
~300

Start learning today

Try every course free for 7 days. After that, this course is in Learnix Pro (KES 699/month).

Create free account Log in

What you'll learn

Write, compile and run Java programs

Use variables, types, conditions and loops confidently

Organise code into methods and classes

Apply inheritance, interfaces and encapsulation

Work with lists and maps, and handle errors with exceptions

How the lessons work

Clear explanations

Step-by-step lessons in plain language

37 in this course

Worked examples

Real code and examples you can copy and run

41 in this course

Quick checks

Test your understanding as you go

45 in this course

Fill the blank

Recall the key commands and syntax

21 in this course

Hands-on workspace

A practical task at the end of every lesson

20 in this course

Syllabus

  1. 1.1

    What Java Is and Your First Program

    Java runs on billions of devices: Android phones, bank servers, point-of-sale systems. Write and run your first program and see how Java code becomes a running app.

  2. 1.2

    Variables and Data Types

    Java wants to know what kind of value every variable holds. Learn the core types, how to convert between them, and why that strictness saves you from bugs.

  3. 1.3

    Decisions and Loops

    Programs become useful when they make decisions and repeat work. Master if/else, switch, and the for, while and for-each loops.

  4. 1.4

    Reading Input and Formatting Output

    Programs get interesting when they respond to people. Read keyboard input with Scanner, validate it, and print tidy, formatted results.

  1. 2.1

    Methods: Reusable Blocks of Code

    Stop repeating yourself. Write methods with parameters and return values, and learn overloading and how Java passes values.

  2. 2.2

    Arrays and Working with Text

    Store many values in one variable and clean, split and format text: skills you will use in every app form.

  3. 2.3

    Classes and Objects

    Object-oriented programming is the heart of Java, and of Android. Model real things as classes with fields, constructors and methods.

  4. 2.4

    Inheritance, Interfaces and Polymorphism

    Share behaviour between classes and write code that works with many types at once: exactly how Android's Activity and listener classes work.

  5. 2.5

    Enums and Records: Modelling Data Cleanly

    Replace magic strings with enums that the compiler checks, and replace boilerplate classes with one-line records. Cleaner models mean fewer bugs.

  1. 3.1

    Collections: ArrayList and HashMap

    Arrays have a fixed size; real apps need lists that grow and fast lookups by key. Meet ArrayList, HashMap and generics.

  2. 3.2

    Generics: Code That Works for Any Type

    Write one class or method that safely works with Strings, numbers or your own types. Generics are why List<String> exists, and every Android library uses them.

  3. 3.3

    Streams and Lambdas: Processing Data in One Line

    Filter, transform, group and total collections the modern way. Streams turn ten-line loops into readable pipelines, and lambdas are how Android handles clicks.

  4. 3.4

    Handling Errors with Exceptions

    Apps meet bad input, missing files and lost connections. Catch problems gracefully instead of crashing.

  5. 3.5

    Files and Dates

    Save and load data from files so it survives after the program closes, and handle dates and times correctly: due dates, ages and receipts.

  1. 4.1

    Packages, Gradle and Testing with JUnit

    Leave the single-file playground: organise code into packages, pull in libraries with Gradle, and prove your code works with automated tests.

  2. 4.2

    Mini Project: A Console Shop

    Put it all together (classes, collections, methods and exceptions) in a small shop program. This is the thinking you will reuse in your first Android app.

  1. 5.1

    StringBuilder, Regular Expressions & Validation

    Build text efficiently, validate phone numbers, emails and KRA PINs with regular expressions, and extract data from messages.

  2. 5.2

    Calling Web APIs: HttpClient & JSON

    Use Java's built-in HttpClient to call REST APIs, handle status codes and timeouts, and turn JSON into objects with Gson.

  3. 5.3

    Databases with JDBC

    Connect Java to MySQL or SQLite with JDBC, run safe parameterised queries, map rows to objects and use transactions.

  4. 5.4

    Doing Work in Parallel: Threads, Executors & CompletableFuture

    Run slow tasks concurrently with ExecutorService and CompletableFuture, avoid race conditions, and use virtual threads.

Earn a verifiable certificate

Finish every lesson and pass the 20-question final exam (70% to pass). Each certificate has a unique number anyone can check online.

Get started

Helping with:

🍪 We use essential cookies to keep you signed in, protect your account and remember your settings. We don't use advertising or tracking cookies. Read our Privacy Policy.