Java Fundamentals
Learn Java from zero: variables, decisions, loops, methods, classes and collections — the foundation for building Android apps with Java.
4
units
16
lessons
50
practice questions
~240
minutes
Start learning today
Create a free account, then unlock this and every other Pro course with Learnix Pro for KES 999/month.
Create free account I already have an accountOutcomes
What you'll be able to do
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 it works
Read it, see it, practise it
Each lesson explains one topic clearly, shows worked examples, checks your understanding with quick questions and ends with a practical task you complete yourself.
Clear explanations
Step-by-step lessons in plain language
32 in this course
Worked examples
Real code and examples you can copy and run
34 in this course
Quick checks
Test your understanding as you go
33 in this course
Fill the blank
Recall the key commands and syntax
17 in this course
Hands-on workspace
A practical task at the end of every lesson
16 in this course
Syllabus
Everything you'll encounter
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.
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.
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.
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.
Methods: Reusable Blocks of Code
Stop repeating yourself. Write methods with parameters and return values, and learn overloading and how Java passes values.
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.
Classes and Objects
Object-oriented programming is the heart of Java — and of Android. Model real things as classes with fields, constructors and methods.
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.
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.
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.
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.
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.
Handling Errors with Exceptions
Apps meet bad input, missing files and lost connections. Catch problems gracefully instead of crashing.
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.
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.
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.
Finish the course, earn a verifiable certificate
Complete every lesson to receive a Learnix certificate with a unique number anyone can verify online.