Hello,
im trying to make a simple guessing game in ecclipse
i have the error "c connot be resolved to a variable.
import java.util.Random; import java.util.Scanner; public class Game { public static void main(String[] args) { question(); } static void question() { System.out.println("Guess the number between 1 and 10"); Random rand = new Random(); Scanner myObj = new Scanner(System.in); int a = rand.nextInt(10-0)+1; String userGuess = myObj.nextLine(); String b = userGuess; c = a.toString(); System.out.println(userGuess); if (b == c) { System.out.println("correct"); } else { System.out.println("wrong"); } } }