Build a Quiz Game in Java

Build an interactive terminal quiz game using core Java fundamentals.

Introduction

30 Second Summary

Think about the quiz apps you have taken online or on your phone. Someone had to write the code that stores each question, checks your answer, and keeps track of your score.

In this project, you will build an interactive quiz game in Java that runs in your terminal. You will create custom classes, handle user input, and display a final score.

What You'll Build

A command-line quiz game that asks multiple-choice questions, accepts player answers, tracks correct responses, and displays results using object-oriented Java.

By the end of this project, you'll have:

  • A Question class that stores question text, answer choices, and the correct answer index.
  • A QuizGame class that runs the game loop, processes user input, and calculates the final score.
  • A Main class that wires your questions together and launches the game.
  • Secret Mission: Add a timed mode where players only have 10 seconds per question.

Are there any prerequisites?

No prior Java experience is needed. This guide walks you through installing all required tools from scratch, including the Java Development Kit and IntelliJ IDEA.

Before We Start

Before We Start...

Set Up Java and IntelliJ IDEA

To build a Java program, you need two things: a compiler that turns your code into something the computer can run, and an editor that helps you write the code.

In this step, you will install the Java Development Kit (JDK) and IntelliJ IDEA, a powerful code editor built specifically for Java. Then you will create the project that holds your quiz game code.

In this step, get ready to:
  • Install JDK 25 (Java's compiler and runtime).
  • Install IntelliJ IDEA (your Java code editor).
  • Create the QuizGame project.
Install JDK 25

The Java Development Kit (JDK) is the toolkit that compiles your Java code and runs it. Your quiz game needs JDK 25, the latest Long-Term Support release.

  • Press Cmd+Space (macOS) or the Windows key (Windows) to open your search bar.
  • Type Terminal (macOS) or Command Prompt (Windows) and press Enter to open it.
  • Check if Java is already installed by running this command:
java -version

✔️ I see version 25 or higher

Your JDK is ready. Skip ahead to the next substep to install IntelliJ IDEA.

ⓧ I see an older version

You have Java installed, but you need version 25 for this project. Installing JDK 25 will update your system to use the new version.

  • Open the Oracle JDK downloads page at oracle.com/java/technologies/downloads.
  • Select the JDK 25 tab at the top of the page.
  • Download the installer for your operating system (macOS or Windows).
  • Run the installer and follow the prompts to complete the installation.
  • Close your terminal and open a new one.
  • Run java -version again to confirm it now shows version 25.

Still seeing the old version?

On macOS, if java -version still shows the old version after installing JDK 25, try running /usr/libexec/java_home -V to see all installed JDKs. If JDK 25 appears in the list, your PATH may need updating.

On Windows, restart your computer after installation to ensure the system PATH picks up the new JDK.

help me fix my java -version showing the wrong version after installing JDK 25

ⓧ Command not found

Java is not installed on your machine yet. Let's install JDK 25 from Oracle.

  • Open the Oracle JDK downloads page at oracle.com/java/technologies/downloads.
  • Select the JDK 25 tab at the top of the page.
  • Download the installer for your operating system (macOS or Windows).
  • Run the installer and follow the prompts to complete the installation.
  • Close your terminal and open a new one.
  • Verify the installation by running this command:
java -version

You should see output that starts with java version "25" followed by build information.

Still seeing command not found?

Make sure you closed your old terminal and opened a fresh one after installation. The terminal needs to reload your system PATH to find the new JDK.

help me troubleshoot java not being found after installing JDK 25

Install IntelliJ IDEA

IntelliJ IDEA is the most popular code editor for Java developers. It catches errors as you type and suggests code completions, which makes learning Java much smoother.

✔️ I already have IntelliJ IDEA

You are all set. Skip ahead to the next substep to create your project.

ⓧ I need to install it

  • Open the IntelliJ IDEA download page at jetbrains.com/idea/download.
  • Download the installer for your operating system.
  • Run the installer and follow the prompts to complete the installation.

Is IntelliJ IDEA free?

IntelliJ IDEA is a unified product. Core Java features are completely free with no authorization required.

On first launch, IntelliJ starts a 30-day Ultimate trial. After the trial ends, all the features you need for this project remain free.

Create a new Java project

Now that your tools are installed, you will create the project that holds all your quiz game code. IntelliJ organizes your source code, build settings, and files into a single project.

  • Press Cmd+Space (macOS) or the Windows key (Windows) to open your search bar.
  • Type IntelliJ IDEA and press Enter to open it.
  • On the Welcome screen, click New Project.
  • Select Java from the list on the left.
  • In the Name field, type QuizGame.
  • Make sure IntelliJ is selected as the Build system.
  • In the JDK dropdown, select version 25.

Don't see JDK 25 in the dropdown?

If JDK 25 does not appear in the list, click the JDK dropdown and select Download JDK. In the dialog that appears, choose version 25 and click Select. IntelliJ will download and configure it for you automatically.

  • Disable the Add sample code checkbox (you will write everything from scratch).
  • Click Create.

IntelliJ will create and load your project. After a few seconds, you should see the Project tool window on the left side with a src folder inside your QuizGame project.

What is the src folder?

The src folder is where all your Java source code files will live. In the next step, you will create your first class inside this folder.

Don't see the src folder?

Make sure the Project tool window is open on the left side. You can toggle it by pressing Alt+1 (Windows) or Cmd+1 (macOS).

If the project is still loading, wait for the progress bar at the bottom of the window to finish.

help me find the src folder in my IntelliJ IDEA project

Your development environment is ready. Next up, you will create your first Java class to store quiz questions.

Create the Question Class

Your development environment is ready with Java and IntelliJ IDEA installed. Now it's time to write your first Java class.

Every quiz question needs three pieces of information: the question itself, the answer choices, and which choice is correct. You'll create a Question class that bundles these three pieces together into a single reusable object.

In this step, get ready to:
  • Create a new Java class file in your project.
  • Define fields and a constructor to store question data.
  • Add getter methods so other classes can read the data.
Create the Question.java file

In Java, every class lives in its own file. You'll create a Question.java file that IntelliJ IDEA will pre-fill with a basic class shell.

  • In the Project tool window on the left side, find and right-click the src folder.
  • Select New, then Java Class.
  • Type Question as the class name and press Enter.

What just happened?

IntelliJ created a Question.java file and automatically generated the class declaration for you. You should see a file open in the editor with public class Question { } already written.

Don't see Java Class in the menu?

The Java Class option only appears when you right-click a folder marked as a Source Root. Make sure you are right-clicking the src folder (it should appear blue in the Project tool window), not the project root folder.

help me find the Java Class option in IntelliJ IDEA

Add fields and a constructor

Fields are variables that belong to a class. A constructor is a special method that runs when you create a new object, setting up its initial data.

  • Replace everything in Question.java with the following code:
public class Question {
    // The question text shown to the player
    private String text;
    // Array of possible answer choices
    private String[] choices;
    // Index of the correct answer in the choices array
    private int correctAnswerIndex;

    // Constructor initializes a question with its data
    public Question(String text, String[] choices, int correctAnswerIndex) {
        this.text = text;
        this.choices = choices;
        this.correctAnswerIndex = correctAnswerIndex;
    }
}

What does this code do?

  • private String text stores the question text (e.g. "What is the capital of France?").
  • private String[] choices stores an array of answer options the player picks from.
  • private int correctAnswerIndex stores which choice is the right answer as a number (0 for the first choice, 1 for the second, etc.).
  • The private keyword means only code inside this class can directly access these fields. Other classes will use getter methods instead.
  • The constructor public Question(...) takes all three values and assigns them using this. to distinguish the field from the parameter.
  • Save the file with Cmd+S (macOS) or Ctrl+S (Windows).
  • Check that there are no red underlines in the editor. No red means your code compiles without errors.

Seeing red underlines?

Make sure the class name Question matches the filename Question.java exactly (including capitalization). Also check that every opening brace { has a matching closing brace }.

help me fix red underlines in my Question.java file

Add getter methods

Since the fields are private, other classes cannot read them directly. Getter methods provide controlled read access to each field.

  • In Question.java, place your cursor on the blank line just above the final closing brace } and add the following getter methods:
    // Return the question text
    public String getText() {
        return text;
    }

    // Return the array of answer choices
    public String[] getChoices() {
        return choices;
    }

    // Return the index of the correct answer
    public int getCorrectAnswerIndex() {
        return correctAnswerIndex;
    }

What does this code do?

Each getter method returns the value of one private field. The method name follows Java's naming convention: get followed by the field name with a capital first letter.

When the QuizGame class needs to display a question's text, it calls question.getText() instead of accessing question.text directly. This pattern is called encapsulation.

  • Save Question.java with Cmd+S (macOS) or Ctrl+S (Windows).
  • Confirm there are no red underlines anywhere in the file. Your Question class is complete.

Red underlines on the getter methods?

Make sure each getter is placed inside the class body (between the outermost { and } braces), not outside them. Also check that the return types match: String for getText(), String[] for getChoices(), and int for getCorrectAnswerIndex().

help me fix my getter methods in Question.java

✔️ Awesome, I've got everything!

Great. Double check you've saved your file before moving on.

ⓧ I'd like to double check the full code

Here is the complete Question.java file. Make sure yours matches exactly:

public class Question {
    private String text;
    private String[] choices;
    private int correctAnswerIndex;

    public Question(String text, String[] choices, int correctAnswerIndex) {
        this.text = text;
        this.choices = choices;
        this.correctAnswerIndex = correctAnswerIndex;
    }

    public String getText() {
        return text;
    }

    public String[] getChoices() {
        return choices;
    }

    public int getCorrectAnswerIndex() {
        return correctAnswerIndex;
    }
}

Your Question class is ready to hold quiz data. Next up, you'll build the QuizGame class that uses these questions to run an interactive game loop.

Build the QuizGame Class

Your Question class is ready to store quiz data. Now you'll build the class that actually runs the game.

The QuizGame class uses Java's Scanner to read player input from the terminal. It needs a loop to present questions, logic to check answers, and a way to handle invalid input gracefully.

In this step, get ready to:
  • Create the QuizGame class with fields and a constructor.
  • Write the game loop that presents questions and checks answers.
  • Display the player's final score and a performance message.
Create the QuizGame.java file

The QuizGame class manages the game state. It holds the list of questions, the player's current score, and a Scanner for reading keyboard input.

  • In the Project tool window on the left side of IntelliJ, right-click the src folder.
  • Select New, then Java Class.
  • Type QuizGame as the class name and press Enter.
  • Replace everything IntelliJ generated with the following code:
import java.util.Scanner;

public class QuizGame {
    private Question[] questions;
    private int score;
    private Scanner scanner;

    public QuizGame(Question[] questions) {
        this.questions = questions;
        this.score = 0;
        this.scanner = new Scanner(System.in);
    }
}

What does this code do?

This sets up the foundation for your game class.

  • import java.util.Scanner brings in Java's built-in class for reading keyboard input.
  • The three private fields store the questions array, the running score, and the Scanner instance.
  • The constructor receives a questions array and initializes the score to 0.
  • Save QuizGame.java with Cmd+S (macOS) or Ctrl+S (Windows).
  • Check that IntelliJ shows no red underlines in the file.

Seeing red underlines on Question?

Make sure Question.java exists in the same src folder as QuizGame.java. IntelliJ needs both files in the same source root to find the Question class.

Help me debug this

Add the game loop

The game loop is the heart of your program. It cycles through each question, presents it to the player, reads their answer, and tells them if they got it right.

  • In QuizGame.java, place your cursor on the blank line just above the closing } of the class.
  • Add the play() method by pasting this code:
    public void play() {
        System.out.println("Welcome to the Quiz Game!");
        System.out.println("Answer each question by typing the number of your choice.");
        System.out.println();

        for (int i = 0; i < questions.length; i++) {
            System.out.println("Question " + (i + 1) + " of " + questions.length);
            askQuestion(questions[i]);
            System.out.println();
        }

        displayResults();
    }

What does this code do?

The play() method is the main entry point for running the game.

  • It prints a welcome message so the player knows what to do.
  • The for loop iterates through every question in the array, calling askQuestion() for each one.
  • After the loop finishes, it calls displayResults() to show the final score.
  • Save the file.
  • You will see red underlines on askQuestion and displayResults. This is expected because those methods do not exist yet.

Seeing errors other than the missing methods?

Check that your play() method is inside the class braces but outside the constructor. Every method must sit between the class opening { and closing }.

Help me fix my play() method errors

  • Add the askQuestion() method directly below play():
    private void askQuestion(Question question) {
        System.out.println(question.getText());
        String[] choices = question.getChoices();

        for (int i = 0; i < choices.length; i++) {
            System.out.println("  " + (i + 1) + ". " + choices[i]);
        }

        System.out.print("Your answer: ");
        int answer = getValidInput(choices.length);

        if (answer - 1 == question.getCorrectAnswerIndex()) {
            System.out.println("Correct!");
            score++;
        } else {
            System.out.println("Wrong! The correct answer was: " + choices[question.getCorrectAnswerIndex()]);
        }
    }

What does this code do?

The askQuestion() method handles one question at a time.

  • It prints the question text, then loops through the choices array to display numbered options.
  • getValidInput() ensures the player types a valid number before continuing.
  • The answer - 1 comparison converts from the player's 1-based input to Java's 0-based array index.
  • Save the file.
  • The red underline on askQuestion in play() is now gone. You will still see underlines on getValidInput and displayResults.
  • Add the getValidInput() method directly below askQuestion():
    private int getValidInput(int maxChoice) {
        while (true) {
            if (scanner.hasNextInt()) {
                int input = scanner.nextInt();
                if (input >= 1 && input <= maxChoice) {
                    return input;
                }
            } else {
                scanner.next();
            }
            System.out.print("Please enter a number between 1 and " + maxChoice + ": ");
        }
    }

What does this code do?

This method protects your game from crashing when the player types something unexpected.

  • The while (true) loop keeps running until the player enters a valid number.
  • scanner.hasNextInt() checks if the input is actually a number before trying to read it.
  • If the player types letters or a number outside the valid range, the method asks them to try again.
  • Save the file.
  • The only remaining red underline should be on displayResults inside the play() method.

Seeing more red underlines than expected?

Make sure each method sits between the class braces and is not accidentally nested inside another method. Every { must have a matching }. Count your braces from top to bottom to find mismatches.

Help me fix my brace placement

Display results

After the player answers all questions, your game needs to announce their final score. A performance message based on their percentage makes the experience feel more rewarding.

  • Add the displayResults() method directly below getValidInput():
    private void displayResults() {
        System.out.println("=== Quiz Complete! ===");
        System.out.println("Your score: " + score + " out of " + questions.length);

        double percentage = (double) score / questions.length * 100;

        if (percentage == 100) {
            System.out.println("Perfect score! You're a genius!");
        } else if (percentage >= 80) {
            System.out.println("Great job! You really know your stuff!");
        } else if (percentage >= 60) {
            System.out.println("Not bad! Keep learning!");
        } else {
            System.out.println("Better luck next time! Practice makes perfect.");
        }
    }

What does this code do?

This method wraps up the game with a summary.

  • It prints the raw score (e.g. "3 out of 5").
  • (double) score casts the integer to a decimal so the division produces a percentage instead of rounding to 0.
  • The if/else if chain picks a message based on the percentage, giving the player tiered feedback.
  • Save QuizGame.java.
  • All red underlines should now be gone. IntelliJ can find every method that play() references.

Still seeing a red underline on displayResults?

Make sure the method name is spelled exactly displayResults with a capital R. Java method names are case-sensitive.

Help me fix my displayResults method

✔️ Awesome, I've got everything!

Great. Double check you have saved QuizGame.java and that IntelliJ shows zero red underlines in the file.

ⓧ I'd like to double check the full code

import java.util.Scanner;

public class QuizGame {
    private Question[] questions;
    private int score;
    private Scanner scanner;

    public QuizGame(Question[] questions) {
        this.questions = questions;
        this.score = 0;
        this.scanner = new Scanner(System.in);
    }

    public void play() {
        System.out.println("Welcome to the Quiz Game!");
        System.out.println("Answer each question by typing the number of your choice.");
        System.out.println();

        for (int i = 0; i < questions.length; i++) {
            System.out.println("Question " + (i + 1) + " of " + questions.length);
            askQuestion(questions[i]);
            System.out.println();
        }

        displayResults();
    }

    private void askQuestion(Question question) {
        System.out.println(question.getText());
        String[] choices = question.getChoices();

        for (int i = 0; i < choices.length; i++) {
            System.out.println("  " + (i + 1) + ". " + choices[i]);
        }

        System.out.print("Your answer: ");
        int answer = getValidInput(choices.length);

        if (answer - 1 == question.getCorrectAnswerIndex()) {
            System.out.println("Correct!");
            score++;
        } else {
            System.out.println("Wrong! The correct answer was: " + choices[question.getCorrectAnswerIndex()]);
        }
    }

    private int getValidInput(int maxChoice) {
        while (true) {
            if (scanner.hasNextInt()) {
                int input = scanner.nextInt();
                if (input >= 1 && input <= maxChoice) {
                    return input;
                }
            } else {
                scanner.next();
            }
            System.out.print("Please enter a number between 1 and " + maxChoice + ": ");
        }
    }

    private void displayResults() {
        System.out.println("=== Quiz Complete! ===");
        System.out.println("Your score: " + score + " out of " + questions.length);

        double percentage = (double) score / questions.length * 100;

        if (percentage == 100) {
            System.out.println("Perfect score! You're a genius!");
        } else if (percentage >= 80) {
            System.out.println("Great job! You really know your stuff!");
        } else if (percentage >= 60) {
            System.out.println("Not bad! Keep learning!");
        } else {
            System.out.println("Better luck next time! Practice makes perfect.");
        }
    }
}

Your game engine is complete. Next up, you'll create the Main class that builds the quiz questions and starts the game.

Create the Main Class and Run the Game

You now have two powerful classes: Question knows how to store quiz data, and QuizGame knows how to run a quiz. But neither class does anything on its own.

Every Java program needs an entry point that the computer calls first when you hit "run." In this step, you will create that entry point, load it with questions, and play through your finished quiz game.

In this step, get ready to:
  • Create the Main class with Java's entry point method.
  • Build an array of quiz questions.
  • Run the game and test it with correct and incorrect answers.
Create Main.java

Java looks for a special method called public static void main(String[] args) as the starting point of any program. The class containing this method is what IntelliJ runs when you press play.

  • In the Project panel on the left side of IntelliJ, right-click the src folder.
  • Select New, then Java Class.
  • Type Main as the class name and press Enter.

IntelliJ creates Main.java with an empty class body. You will replace its contents in the next substep.

Build your quiz questions and launch the game

The main method is where you create your Question objects, pack them into an array, and hand them to a QuizGame instance to play.

  • Replace the entire contents of Main.java with the following code:
public class Main {
    public static void main(String[] args) {
        // Create an array to hold 5 questions
        Question[] questions = new Question[5];

        // Each Question takes: text, four choices, and the index of the correct choice
        questions[0] = new Question(
            "What is the capital of France?",
            new String[]{"London", "Berlin", "Paris", "Madrid"},
            2
        );

        questions[1] = new Question(
            "Which planet is known as the Red Planet?",
            new String[]{"Venus", "Mars", "Jupiter", "Saturn"},
            1
        );

        questions[2] = new Question(
            "What is the largest ocean on Earth?",
            new String[]{"Atlantic", "Indian", "Arctic", "Pacific"},
            3
        );

        questions[3] = new Question(
            "Who painted the Mona Lisa?",
            new String[]{"Van Gogh", "Picasso", "Da Vinci", "Rembrandt"},
            2
        );

        questions[4] = new Question(
            "What is the chemical symbol for gold?",
            new String[]{"Go", "Gd", "Au", "Ag"},
            2
        );

        // Create the game with our questions and start playing
        QuizGame game = new QuizGame(questions);
        game.play();
    }
}

What does this code do?

This class ties your entire project together.

  • Question[] questions = new Question[5] creates an array that can hold exactly 5 Question objects.
  • Each new Question(...) call passes the question text, a String[] array of four choices, and the zero-based index of the correct answer.
  • new QuizGame(questions) passes the full array to your game class, and game.play() kicks off the game loop you wrote earlier.

What is a zero-based index?

Java counts array positions starting from 0, not 1. In the first question, Paris is at index 2 (London=0, Berlin=1, Paris=2, Madrid=3). This is why the correct answer for "What is the capital of France?" is 2 and not 3.

  • Save Main.java by pressing Cmd+S (macOS) or Ctrl+S (Windows).
  • Check that IntelliJ shows no red underlines in the editor. If you see red squiggles, there is a typo somewhere in your code.

Seeing red underlines?

  • Make sure Question.java and QuizGame.java are in the same src folder as Main.java. Java needs all three files to find each other.
  • Check that the class name inside each file matches the filename exactly. Main.java must contain public class Main.
  • Hover over a red underline to read IntelliJ's error message. It usually tells you exactly what is wrong.

Still stuck? Ask for help.

✔️ Awesome, I've got everything!

Great. Double check you have saved your file, then move on to running the game.

ⓧ I'd like to double check the full code

Here is the complete Main.java file for comparison:

public class Main {
    public static void main(String[] args) {
        Question[] questions = new Question[5];

        questions[0] = new Question(
            "What is the capital of France?",
            new String[]{"London", "Berlin", "Paris", "Madrid"},
            2
        );

        questions[1] = new Question(
            "Which planet is known as the Red Planet?",
            new String[]{"Venus", "Mars", "Jupiter", "Saturn"},
            1
        );

        questions[2] = new Question(
            "What is the largest ocean on Earth?",
            new String[]{"Atlantic", "Indian", "Arctic", "Pacific"},
            3
        );

        questions[3] = new Question(
            "Who painted the Mona Lisa?",
            new String[]{"Van Gogh", "Picasso", "Da Vinci", "Rembrandt"},
            2
        );

        questions[4] = new Question(
            "What is the chemical symbol for gold?",
            new String[]{"Go", "Gd", "Au", "Ag"},
            2
        );

        QuizGame game = new QuizGame(questions);
        game.play();
    }
}
Run the game and test your answers

Your code is complete. Time to see all three classes working together.

  • Click the green play button (triangle icon) in the top-right toolbar of IntelliJ.
  • If you see a dropdown, select Main as the class to run.

Where is the green play button?

You can also click the small green triangle in the gutter (left margin) next to public static void main in your editor. Both options do the same thing.

The Run panel opens at the bottom of IntelliJ. You should see the welcome message followed by your first question with four numbered choices.

  • Click inside the Run panel at the bottom where the cursor is blinking.
  • Type 3 and press Enter to answer the first question (Paris is choice 3).
  • Continue answering all 5 questions. Try getting some right and some wrong to test both paths.
  • After the last question, you should see your final score and a performance message.

What should I see?

Your terminal output starts with "Welcome to the Quiz Game!" followed by each question and numbered choices. After answering, you see either "Correct!" or "Wrong! The correct answer was:" with the right choice. At the end, a score summary and a message based on your performance appears.

Nothing happens when you type?

  • Make sure you click inside the Run panel's input area (not the editor area above). The cursor must be blinking in the output panel for input to register.
  • If IntelliJ says it cannot find the main class, right-click Main.java in the Project panel and select Run 'Main.main()'.
  • If you type a letter instead of a number, the game asks you to enter a valid number. This is your getValidInput() method at work.

Need more help debugging?

Your quiz game is alive. You have built a complete Java application from scratch using classes, arrays, loops, conditionals, and user input. Next up is an optional Secret Mission where you can push your skills further by adding a countdown timer.

Secret mission

Add a Timed Mode

Your quiz game works great, but real game shows have time pressure. Can you add a 10-second countdown timer to each question? If time runs out, the player loses the point and the game moves on. This introduces you to Java threads and concurrent programming.

Clean Up Your Resources

Clean Up Your Resources

This project runs entirely locally, so there are no ongoing costs. Decide whether to keep your resources running, pause them to come back later, or delete them entirely.

Resources you used:

  • QuizGame project (local files in IntelliJ IDEA).
  • IntelliJ IDEA (installed application).
  • JDK 25 (installed software).

Keep everything running

No action needed. Choose this if you are still actively building or want to add more questions to your quiz game.

  • Your QuizGame project stays in IntelliJ IDEA, ready to open and run anytime.
  • IntelliJ IDEA and JDK 25 remain installed on your machine for future Java projects.

Pause - I'll come back to this later

Close IntelliJ IDEA to free up memory. Your project files stay on disk and are ready to reopen when you come back.

  • Close IntelliJ IDEA by quitting the application.
  • Your QuizGame project files remain saved on your computer. Reopen the project from IntelliJ's welcome screen next time.

Delete - I don't want to use this again

Remove all project resources and uninstall the tools if you no longer need them.

  • Delete the QuizGame project folder. Open a terminal and run the appropriate command for your operating system.

macOS

rm -rf ~/IdeaProjects/QuizGame
  • To uninstall IntelliJ IDEA, open Finder, go to Applications, and drag IntelliJ IDEA to the Trash.
  • To uninstall JDK 25, open Finder, press Cmd+Shift+G, type /Library/Java/JavaVirtualMachines/, and delete the JDK 25 folder.

Windows

rmdir /s /q %USERPROFILE%\IdeaProjects\QuizGame
  • To uninstall IntelliJ IDEA, open Settings, select Apps, find IntelliJ IDEA in the list, and click Uninstall.
  • To uninstall JDK 25, open Settings, select Apps, find Java(TM) SE Development Kit in the list, and click Uninstall.
  • Empty your Trash (macOS) or Recycle Bin (Windows) to fully reclaim disk space.

Nice Work!

Nice Work!

Congratulations, you just built your first Java application from scratch. You now have an interactive quiz game running in your terminal that demonstrates the core building blocks of Java programming.

Here's what you learned:

  • Built a custom Question class with fields, a constructor, and getter methods to store quiz data.
  • Created a QuizGame class with a game loop, user input handling, and a scoring system.
  • Wrote a Main class that wires everything together using arrays, loops, and conditionals.
  • Added a timed mode using Java threads for concurrent programming.

Ready to quiz yourself?