Backend track

Java Tutorial

Learn Java from zero: syntax, OOP, collections, generics, streams, exceptions, multithreading, JDBC, JUnit and a first Spring Boot API.

BeginnerExamples target Java 21 LTS (they also run on Java 25).
0/31 complete
Topics
31
Full lessons
31
Est. hours
~6
Interview Qs
10

Overview

Java is one of the most widely used programming languages, powering enterprise back ends, Android apps, big-data tools and countless services in banks and IT companies.

This track starts with the basics and moves through object-oriented programming, the collections framework, modern features such as lambdas, streams and records, then database access with JDBC, testing with JUnit and building a REST API with Spring Boot.

What you will learn

  • Write Java programs with variables, control flow and methods
  • Apply OOP with classes, interfaces and inheritance
  • Use collections, generics, lambdas and streams
  • Access databases with JDBC and build a Spring Boot REST API

Prerequisites

None — this track starts from the very beginning.

Learning path

The recommended sequence, from beginner to advanced. Each stage builds on the one before.

  1. 1Basics · 9 topics · Beginner
    Introduction to Java · Installing the JDK · Variables and Data Types · Operators · Conditional Statements · Loops · Methods · Arrays · Strings
  2. 2Object-Oriented Java · 7 topics · Beginner → Intermediate
    Classes and Objects · Constructors · Encapsulation · Inheritance · Polymorphism · Abstract Classes and Interfaces · Packages and Access Modifiers
  3. 3Core APIs · 8 topics · Intermediate
    Exception Handling · Collections Framework · Generics · Lambda Expressions · Streams API · Optional · File I/O · Date and Time API
  4. 4Advanced & Ecosystem · 6 topics · Advanced
    Multithreading · Records and Sealed Classes · Maven and Gradle · JDBC · Unit Testing with JUnit · Spring Boot Basics
  5. 5Practice · 1 topics · Advanced
    Interview Questions

Complete topic list

31 topics
1

Basics

9 topics
  1. Introduction to JavaBeginner5m
  2. Installing the JDKBeginner5m
  3. Variables and Data TypesBeginner5m
  4. OperatorsBeginner5m
  5. Conditional StatementsBeginner5m
  6. LoopsBeginner5m
  7. MethodsBeginner5m
  8. ArraysBeginner5m
  9. StringsBeginner5m
2

Object-Oriented Java

7 topics
  1. Classes and ObjectsBeginner5m
  2. ConstructorsBeginner5m
  3. EncapsulationBeginner5m
  4. InheritanceBeginner5m
  5. PolymorphismBeginner5m
  6. Abstract Classes and InterfacesIntermediate5m
  7. Packages and Access ModifiersIntermediate5m
3

Core APIs

8 topics
  1. Exception HandlingIntermediate5m
  2. Collections FrameworkIntermediate5m
  3. GenericsIntermediate5m
  4. Lambda ExpressionsIntermediate5m
  5. Streams APIIntermediate5m
  6. OptionalIntermediate5m
  7. File I/OIntermediate5m
  8. Date and Time APIIntermediate5m
4

Advanced & Ecosystem

6 topics
  1. MultithreadingAdvanced5m
  2. Records and Sealed ClassesAdvanced5m
  3. Maven and GradleAdvanced5m
  4. JDBCAdvanced5m
  5. Unit Testing with JUnitAdvanced5m
  6. Spring Boot BasicsAdvanced5m
5

Practice

1 topics
  1. Interview QuestionsAdvanced15m

Code example

A taste of the track, from Introduction to Java.

JavaHello.java Illustrative
public class Hello {
    public static void main(String[] args) {
        String name = "Techie Babaji";
        System.out.println("Namaste from Java, " + name + "!");
    }
}


// Compile and run:
//   javac Hello.java      → creates Hello.class (bytecode)
//   java Hello            → the JVM runs it
// Java 11+ can also run a single file directly:  java Hello.java
Expected output
Namaste from Java, Techie Babaji!

Practice exercises

Show all 30 exercises
Methods

Write a method isAdult(int age) that returns true for 18 or above.

Arrays

Find the highest mark in the array.

Strings

Count the vowels in a string.

Classes and Objects

Add a withdraw(double amount) method that only withdraws if the balance is enough.

Constructors

Add a constructor Product(String name) with a default price of 1.0.

Encapsulation

Make an Employee class whose salary can only increase via giveRaise(percent).

Inheritance

Create a CurrentAccount that overrides monthlyFee() to return 100.

Polymorphism

Add a WalletPayment that returns "Paid from wallet".

Abstract Classes and Interfaces

Create an EmailNotifier that implements Notifier and prints "Email to …".

Packages and Access Modifiers

Which access modifier lets only classes in the same package use a method?

Exception Handling

Parse "abc" with Integer.parseInt and print "Invalid number" instead of crashing.

Collections Framework

Count how many times each word appears in a list.

Generics

Write a generic method swap that swaps two elements of a List<T>.

Lambda Expressions

Sort a list of names by length, then alphabetically.

Streams API

Get the names of the top 2 most expensive orders.

Optional

Return the uppercase name of customer 1 or "GUEST".

File I/O

Append a line to log.txt, creating the file if needed.

Date and Time API

Find the date 45 days after today.

Multithreading

Run two async lookups and combine their results with CompletableFuture.

Records and Sealed Classes

Create a record Student(String name, int marks) that rejects marks above 100.

Maven and Gradle

Which Maven command runs only the tests?

JDBC

Insert a product with a PreparedStatement.

Unit Testing with JUnit

Add a test that an unknown coupon gives no discount.

Spring Boot Basics

Add GET /api/products/{id} that returns 404 when not found.

Common interview questions

Frequently asked questions

Java or C# first?
They are very similar. Pick the one used where you want to work: Java dominates many enterprise and Android teams, C# dominates .NET shops. Skills transfer easily.
Which Java version should I learn?
Learn a current LTS release (Java 21 or 25). Everything in this track works on both.