So I want to make a word matching game like crosswords, match the word and other puzzle game in my Java Netbeans. I have had trouble making my int = the words I store in my array.
String word; int numword=0;
// Words that will be stores in my arry
String [] myNames = {"Pie","Soccer","Chelsea","Gaming","Steam"};
// User inputs the number
numword = new Scanner(System.in).nextInt();
// Print the word for testing purposes
System.out.println(myNames[numword]);
// Type the word
word = new Scanner(System.in).nextLine();
// Check if the word is right
if (word.equals(n)){
System.out.println("You got it");
}else{
System.out.println("You got it wrong");
}