Dr. Nim game in Java
Break early instead of nested if


           if (input &gt; 3 || input &lt; 1) {
               System.out.println("You Can Only Remove 3 Marbles At A Time");
           } else {
               ....
           }



The above can be rewritten as a simple if statement with continue, this prevent the indention from creeper up at the side of the screen.

           if (input &gt; 3 || input &lt; 1) {
               System.out.println("You Can Only Remove 3 Marbles At A Time");
               continue;
           }
           ....


Placing the scanner outside the loop

Scanners use internal buffering to buffer its inputstream, this mean they may consume large amounts, instead of only the part they need for the the concurrent operation. When placing the scanner outside the loop, this also allows for the player to put in the moves much quicker after each other, an still having the program pick up every move.

Place Scanner scanInput = new Scanner(System.in); before while(true){, and wrap the scanner in a try with resources like this:

try(Scanner scanInput = new Scanner(System.in)){
    while(true) { 
        ....
    }
}


This also allows you to get rid of @SuppressWarnings("resource").

Proper english doesn't have all words title case

(all println statements)

SOme people have problems with reading sentences with every word uppercase, use the english grammar rules, make only names and the first word of a sentence starting with a uppercase.

Check the state of scanInput.hasNextInt()

You should check the state of scanInput.hasNextInt() before every number is get, this method can return false if the program is accessed by the command line and the command line return EOF, this can be triggered with ctrl + D on linux. The best way to do this is replacing the true in your while loop with the check.

Unused variables


public static int comFirst = (int) (Math.random() * 3 + 1);



At the moment, you have 1 unused variable. Either you will be using this variable for a future expansion, or this variable is left while you were working on the application.

You have won case triggers after the computer move

This case triggers after the computer has done its move. If you really planning on the player to win sometime, you should move this case before the computer makes a move.

Win cases too strict


if (marble - cpuAnswer == 0) {
if (marble - input == 0) {



While with the current implementation of your application, all wins are perfect and ending with exactly 0. If you update your implementation of the computer or player in the future, this may pose a problem in the future.

if (marble - cpuAnswer =&lt; 0) {
if (marble - input =&lt; 0) {


The final result would look like this:

import java.util.Scanner;

public class Main {

    public static int input;
    public static int marble = 12;

    public static void main(String[] args) throws InterruptedException {

        System.out.println("There Are 12 Marbles, You Can Only Remove Up To 3 Marbles At A Time");
        System.out.println("Your Goal Is To Remove The Last Marble, Marble 1");
        System.out.println("To Remove A Marble Either Enter 1, 2 or 3");
        System.out.println("");

        try (Scanner scanInput = new Scanner(System.in)) {
            while (scanInput.hasNextInput()) {

                if (marble == 1) {
                    System.out.println("There Is " + marble + " Marble Remaining");
                } else {
                    System.out.println("There Are " + marble + " Marbles Remaining");
                }

                input = scanInput.nextInt();

                if (input &gt; 3 || input &lt; 1) {
                    System.out.println("You Can Only Remove 3 Marbles At A Time");
                    continue;
                } 
                marble = marble - input;
                if (marble - input =&lt; 0) {
                    System.out.println("There Are No Marbles Remaining, You Have Won!!");
                    return;
                }
                Thread.sleep(250);
                int cpuAnswer = 4 - input;
                if (cpuAnswer == 1) {
                    System.out.println("The Computer Has Removed " + cpuAnswer + " Marble");
                } else {
                    System.out.println("The Computer Has Removed " + cpuAnswer + " Marbles");
                }
                if (marble - cpuAnswer =&lt; 0) {
                    System.out.println("There Are No Marbles Remaining, The Computer Has Won!!");
                    System.out.println("The Computer Has Won");
                    return;
                }

                marble = marble - cpuAnswer;
            }
        }
    }
}


Splitting the main method

By splitting the main method you archieve better code reuse.

@TheCoffeeCup has written an excellent answer for this part of the code.