Practice Java with hands-on exercises designed to reinforce key concepts across all modules and difficulty levels. From beginner fundamentals to advanced topics, each exercise helps you apply what you’ve learned through real coding scenarios.

Use the filters to quickly find exercises by module and level, focus on specific areas, and progress at your own pace. Each exercise includes clear objectives, input/output examples, and starter code(when applicable) to guide your implementation.

Build your skills, gain confidence, and move from theory to practice with structured, real-world Java exercises.

Date and Time
Beginner

Check Leap Year

Determine if a year is leap.

Input:
2024
Output:
TRUE
Explanation: 2024 is divisible by 4 and is a leap year
Date and Time
Beginner

Extract Year Month Day

Extract year, month and day from a date.

Input:
5/20/2024
Output:
2024, 5, 20
Explanation: the date is decomposed into year, month, and day components
Date and Time
Intermediate

Convert Timezone

Convert time from UTC to another timezone.

Input:
2024-01-01T10:00Z
Output:
2024-01-01T11:00+01:00
Explanation: UTC+1 adds one hour to the original time
Date and Time
Beginner

Add Days to Date

Add n days to a given date.

Input:
2024-01-01,  5
Output:
2024-01-06
Explanation: adding 5 days to January 1st results in January 6th
Date and Time
Intermediate

Days Between Dates

Calculate number of days between two dates.

Input:
2024-01-01,  2024-01-10
Output:
9
Explanation: there are 9 days between January 1st and January 10th
Arrays and Loops
Beginner

Compute Average

Compute average of numbers in an array.

Input:
[2,4,6,8]
Output:
5
Explanation: (2+4+6+8) / 4 = 5
Java Foundation
Intermediate

Check Prime Number

Check if a number is prime.

Input:
7
Output:
TRUE
Explanation: 7 has no divisors other than 1 and itself
Number Processing
Beginner

Round Decimal Value

Round a decimal number to 2 places.

Input:
3.14159
Output:
3.14
Explanation: the number is rounded to two decimal places
Number Processing
Intermediate

Sum Big Numbers

Compute sum of very large numbers using BigInteger.

Input:
999999999999 + 1
Output:
1.00E+12
Explanation: the result exceeds standard integer limits and is represented in scientific notation
Number Processing
Beginner

Format Currency

Format a number into currency format.

Input:
1234.5
Output:
1,234.50
Explanation: the number is formatted with thousand separators and two decimal places