Java Practice Exercises and Coding Tasks

ExamClouds has 87 tasks for Java Core practice, split into 12 modules that follow the course: syntax, operators, control flow, arrays, OOP, the static keyword, Object methods, interfaces and enums, lambdas, the Stream API and algorithms. Many tasks come with a hint, and some with a solution and a video walkthrough. Tasks go from simple to more advanced and work for self-study, lab assignments and interview preparation.

Java tasks for beginners

5 modules · 36 tasks · ~11.5 h

How to Create and Run Your First Java Application

Beginner

Practice tasks: compile and run your first Java application from the command line, pass arguments to main(), build a JAR and add it to the classpath with -cp.

☰ 2 tasks ⏱ ~1 hOpen →

Java Syntax Basics: Variables, Identifiers, and Structure

Beginner

Practice Java syntax with hands-on tasks: literals, primitive type casting table, calculator methods, and reading user input with Scanner. With solutions.

☰ 6 tasks ⏱ ~2 hOpen →

Mini project Garland: from bits to arrays

3 parts

A console garland of 32 bulbs that grows with the course: first you control the bulbs with bitwise operators in a single int, then add a mode menu with switch and loops, and finally rewrite the garland using an array.

  1. 1 32 bulbs in one int: blinking and a running light with bitwise operators Basic Operations in Java: Arithmetic and Logical
  2. 2 A mode menu with switch and repeated effects with a for loop Control Flow in Java: if, switch and Loops
  3. 3 A garland on an array: a running light with System.arraycopy() Arrays in Java: How to Create and Use Them

Basic Operations in Java: Arithmetic and Logical

BeginnerGarland · part 1

Six Java operator exercises: an even number check, the minimum by absolute value, a bitwise garland, averages, a decrement countdown and a discount rule.

☰ 6 tasks ⏱ ~2 hOpen →

Control Flow in Java: if, switch and Loops

BeginnerGarland · part 2

Practice Java basics with beginner coding tasks using if, switch, for, while, and do-while. Great for students and interview prep.

☰ 12 tasks ⏱ ~3 hOpen →

Arrays in Java: How to Create and Use Them

BeginnerGarland · part 3

Java array exercises for beginners: create 1D and 2D arrays, find max and min, use Arrays.binarySearch() and System.arraycopy(). With solutions.

☰ 10 tasks ⏱ ~3 hOpen →

Capstone project Online Store: from OOP to JDBC

2 parts

One console application that you grow from module to module: a product catalog, a cart, user login, a receipt with locale and date, saving to a file, serialization and a database via DAO.

  1. 1 Product, Category, Basket and User classes Object-Oriented Programming in Java (OOP Concepts)
  2. 2 Login, catalog and purchase with an enum and switch Interfaces and Enums in Java

OOP and the standard library

5 modules · 33 tasks · ~16.5 h

Object-Oriented Programming in Java (OOP Concepts)

IntermediateOnline Store · part 1

17 hands-on Java OOP tasks: classes, this and super, overloading, inheritance, abstract classes, stack vs heap, garbage collection, final keyword.

☰ 17 tasks ⏱ ~9 hOpen →

The static Keyword in Java

Intermediate

Java static keyword exercises with solutions: count sold flowers with a static variable and build an abstract Fruit class that totals purchase cost.

☰ 2 tasks ⏱ ~1.5 hOpen →

Object Class Methods: equals, hashCode, toString

Intermediate

Java exercises on Object class methods: default equals, hashCode and toString output, overriding toString() and equals(), and comparing objects with ==.

☰ 3 tasks ⏱ ~1.5 hOpen →

Interfaces and Enums in Java

IntermediateOnline Store · part 2

Java interface and enum exercises with solutions: instanceof, enums with fields, constructors and switch, abstract classes. Video walkthroughs included.

☰ 4 tasks ⏱ ~3.5 hOpen →

Lambda Expressions in Java: Syntax and Examples

Intermediate

Seven hands-on Java lambda exercises: Predicate.and, Predicate.or, Consumer.andThen, Function, Supplier and method references, with video solutions.

☰ 7 tasks ⏱ ~1.5 hOpen →

Advanced topics

2 modules · 18 tasks · ~8 h

Sorting Algorithms in Java: Basics and Examples

Advanced

Nine hands-on Java algorithm exercises: array average, Fibonacci numbers, Big O complexity, the swap method, array reversal, Bubble and Selection Sort, linear and binary search.

☰ 9 tasks ⏱ ~4 hOpen →

Java Stream API: Complete Guide with Examples

Advanced

Nine hands-on Java Stream API exercises with Optional and Collectors: filter, map, reduce, groupingBy, joining, orElseGet. Code templates included.

☰ 9 tasks ⏱ ~3.5 hOpen →

Frequently Asked Questions

Where can I practice Java for free?

Right here: all 87 exercises on ExamClouds are free and need no registration. They follow the free Java Core course, and every task page links to the lessons it practices. Write and run the code in your own IDE, for example IntelliJ IDEA: the tasks are not tied to an online editor.

Which Java exercises should a beginner start with?

Start with the Java tasks for beginners group: your first application, syntax, operators, control flow and arrays. Then move on to OOP and the standard library, and finish with lambdas, the Stream API and algorithms. Every module card shows its level, the number of tasks and the estimated time.

Can I use these tasks as Java assignments or lab work?

Yes. The tasks are grouped by course module and go from simple to advanced, so a module works as a ready set of Java assignments or homework. The mini projects on this page grow from module to module and work well as a running lab assignment.

Are there solutions to the Java exercises?

Many tasks include a hint right under the condition, and some come with a solution on Patreon and a video walkthrough. Try to solve each task on your own first, then compare your code with the solution.

How long does it take to finish all the tasks?

Each module card shows an estimated time, from about an hour to several hours. All 87 exercises across 12 modules take roughly 36 hours of focused practice.