Three Card Monte game using Java I made a Three Monte Card game using Java
Problem:

This is the original &quot;ball and cups&quot; game where you try to find out which cup has the ball under it. You may play with three cups and a ball, three cards (two jacks and an ace), or three doors and a car. Basically, randomly select a cup to hide the &quot;ball&quot;. Let the player guess which cup hides the ball. The player wins if they guess correctly.

Problem taken from:

https://programmingbydoing.com/a/three-card-monte.html

My code:
/*
 * Code by CLint
 */


import java.util.Random;
import java.util.Scanner;

public class ThreeCardMonte {
    public static void main(String[] args) {
        Random random = new Random();
        Scanner input = new Scanner(System.in);
        int userInput;

        int randomN = random.nextInt(3)+1;

        System.out.println(&quot;You slide up to Fast Eddie's card table and plop down your cash.\n&quot; +
                &quot;He glances at you out of the corner of his eye and starts shuffling.\n&quot; +
                &quot;He lays down three cards.\n&quot;);
        System.out.println(&quot;Which one is the ace?\n&quot; +
                &quot;\t##\t##\t##\n&quot; +
                &quot;\t##\t##\t##\n&quot; +
                &quot;\t1\t2\t3&quot;);
        System.out.print(&quot;\n&gt; &quot;);
        userInput = input.nextInt();

        if (userInput == randomN) {
            if (randomN == 1) {
                System.out.println(&quot;\nYou nailed it! Fast Eddie reluctantly hands over your winnings, scowling.\n&quot; +
                        &quot;\tAA\t##\t##\n&quot; +
                        &quot;\tAA\t##\t##\n&quot; +
                        &quot;\t1\t2\t3&quot;);
            } else if (randomN == 2) {
                System.out.println(&quot;\nYou nailed it! Fast Eddie reluctantly hands over your winnings, scowling.\n&quot; +
                        &quot;\t##\tAA\t##\n&quot; +
                        &quot;\t##\tAA\t##\n&quot; +
                        &quot;\t1\t2\t3&quot;);
            } else if (randomN == 3) {
                System.out.println(&quot;\nYou nailed it! Fast Eddie reluctantly hands over your winnings, scowling.\n&quot; +
                        &quot;\t##\t##\tAA\n&quot; +
                        &quot;\t##\t##\tAA\n&quot; +
                        &quot;\t1\t2\t3&quot;);
            }
        }

        if (userInput != randomN) {
            if (randomN == 1) {
                System.out.println(&quot;\nHa! Fast Eddie wins again! The ace was card number 1.\n&quot; +
                        &quot;\tAA\t##\t##\n&quot; +
                        &quot;\tAA\t##\t##\n&quot; +
                        &quot;\t1\t2\t3&quot;);
            } else if (randomN == 2) {
                System.out.println(&quot;\nHa! Fast Eddie wins again! The ace was card number 2.\n&quot; +
                        &quot;\t##\tAA\t##\n&quot; +
                        &quot;\t##\tAA\t##\n&quot; +
                        &quot;\t1\t2\t3&quot;);
            } else if (randomN == 3) {
                System.out.println(&quot;\nHa! Fast Eddie wins again! The ace was card number 3.\n&quot; +
                        &quot;\t##\t##\tAA\n&quot; +
                        &quot;\t##\t##\tAA\n&quot; +
                        &quot;\t1\t2\t3&quot;);
            }
        }

    }
}

The output:



PS: I am open for corrections to make my code for efficient and clean.
single responsibility
your class does all things together

reading user input
printing dialogs
handle game logic

by this you violate the openClosed principle. If you want to change your code (eg. play a one of four game) you have to make a lot of changes. If you want to add handling for InputExceptions (see Scanner.nextInt()  you would find the proper place. Make Classes for each responsibility!
minor issues

magic numbers: (3)+1
hardcoded Strings (put them in a language file) - that also helps to separate concerns between dialogs and logic
redundancy (use a formatter for the text from the language files)