import java.io.*;
public class Table {
static char T[][]=new char[3][3];
public static void main(String args[])throws IOException{


System.out.println("Input:T[0][0]~[2][2]");
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{

T[i][j]=(char)System.in.read();
}
}
for(int i=0;i<3;i++)
{
System.out.println();
for(int j=0;j<3;j++)
{
System.out.print(T[i][j]+" ");

}
}
char s='A';
System.out.println("Please enter the c:");
char c=(char)System.in.read();
while(c!='O'&&c!='E')
{
s=rmove(s,c);
if(s=='F')
{
System.out.println("Error!");
}
else
{
System.out.println("OK!");
}
}
}
public static char rmove(char A,char B){
for(int i=0;i<3;i++)
{
if(A==T[i][0])
{
switch(B){
case 'a':{A=T[i][1];break;}
case 'b':{A=T[i][2];break;}
default:{A='F';break;}
}
}
}
return A;
}
}
大家来看看,死循环了,单步调试了一下发现c的值是‘\r’初步估计是从键盘接受字符的时候连回车键也读进去了,怎么修改,麻烦各位大虾啦~~