如果找到单词,我很难将我的布尔值更改为true.
import java.util.Scanner;
public class WordSearch
{
private char[][] array;
private boolean found;
public WordSearch(char[][] inArray)
{
array = inArray;
}
public void play()
{
Scanner in = new Scanner(System.in);
String choice = "";
while(!choice.equals("end"))
{
print();
System.out.println("What word do you want to search for? (Type end to quit)");
choice = in.nextLine();
System.out.println();
switch (choice)
{
case "end":
break;
default:
search(choice);
break;
}
}
}
public void print()
{
for(int i = 0; i < array.length; i++)
{
for(int j …Run Code Online (Sandbox Code Playgroud)