Java exercises with solutions

45 practice problems from the 15 lessons of the Java Programming course, in lesson order and from easy to hard inside each lesson. Open a problem, write your code and press Submit: the tests run in your browser and nothing is sent to a server.

15 easy problems 15 medium problems 15 hard problems

Your first Java program

3 problems · Read the lesson

Variables and types

3 problems · Read the lesson

Decisions and loops

3 problems · Read the lesson

Methods

3 problems · Read the lesson

Arrays

3 problems · Read the lesson

Strings and StringBuilder

3 problems · Read the lesson

Classes and objects

3 problems · Read the lesson

Inheritance and polymorphism

3 problems · Read the lesson

Interfaces, enums and records

3 problems · Read the lesson

Exceptions

3 problems · Read the lesson

Lists and maps

3 problems · Read the lesson

Sets, queues and stacks

3 problems · Read the lesson

Generics

3 problems · Read the lesson

Lambdas and streams

3 problems · Read the lesson

Putting it together: designing a complete program

3 problems · Read the lesson