Java Programming Exercises

    Practical exercises to help you master Java programming concepts through hands-on practice.

    Day 1: Java Basics & Syntax

    Goal: Understand Java structure, variables, data types, conditionals, and loops

    Exercise 1: Hello Java!

    Write a basic Java program that prints:

    • Your name

    • Your favorite language (Java of course 😉)

    • The current year

    Exercise 1 example

    Exercise 2: Calculator

    Make a basic calculator (using if / else if) that takes two integers and an operator (+, -, *, /) and prints the result.

    Exercise 2 example

    Exercise 3: FizzBuzz

    Write a program that prints numbers 1 to 100:

    • "Fizz" if divisible by 3

    • "Buzz" if divisible by 5

    • "FizzBuzz" if divisible by both

    Exercise 3 example

    Exercise 4: Loops Practice

    • Print the first 10 Fibonacci numbers

    • Print a multiplication table (up to 10×10)

    Exercise 4 example