Need help with Java program

It looks like you are trying to create a guessing game in Java where the user has to guess a secret number within a certain range. The game will give them hints and keep track of their guesses.

There are a few issues with the code you have provided:

1-There are several import statements at the beginning of the code, but some of them are unnecessary and will cause errors. For example, the line import java.util.random.RandomGenerator; should be removed, as there is no such class in the Java standard library. The correct import statement for the Random class is import java.util.Random;.

2-There is an error in the ggRules method. The line System.out.println("4) Good luck, and may the odds be in your favor! "); should be indented correctly so that it is part of the method.

3-There is a syntax error at the end of the getInput method. The backslash () at the end of the line u/SuppressWarnings({ "resource", "unused" }) // instruct the compiler to suppress leakage warning should be removed.

4-The startGame method is not defined in the code you provided. This method is called at the end of the main method, but there is no corresponding code block for it.

To fix these issues, you will need to remove the unnecessary import statements, indent the code correctly, remove the syntax errors, and define the startGame method. You may also want to consider adding additional features or refining the gameplay mechanics of your guessing game.

/r/CodingHelp Thread Parent