Hello, I just started using Java last week. And I've decided to try to make my own guessing game without looking up a tutorial on how to do so. My problem is that, it's saying my ints cannot be resolved as variables. So here is my code!
import java.util.Scanner; public class StringVariables { public static void main(String [] args) { int answer1 = your_first_guess; int answer2 = your_second_guess; int answer3 = your_last_guess; Scanner user_input = new Scanner(System.in); String your_first_guess; System.out.println("You have three guesses left"); System.out.println("Please enter your first guess!"); your_first_guess = user_input.next(); if (answer1 != Math.random()){ System.out.println("You are wrong!"); }else{ System.out.println("You are rigtht!");} String your_second_guess; System.out.println("You have two guesses left!"); System.out.println("Please enter your second guess!"); your_second_guess = user_input.next(); String your_last_guess; System.out.println("You have one guess left!"); System.out.println("Please enter your last guess!"); your_last_guess = user_input.next(); } }
Thank you for your help.
P.S. Please don't point out any other mistakes I would like to find them myself!