码:
public void placeO(int xpos, int ypos) {
for(int i=0; i<3;i++)
for(int j = 0;j<3;j++) {
// The line below does not work. what can I use to replace this?
if(position[i][j]==' ') {
position[i][j]='0';
}
}
}
Run Code Online (Sandbox Code Playgroud) 我想检查字符是否为空?但为什么这段代码不起作用?letterChar == null也不起作用。我用谷歌搜索了很多问题,但没有看到任何解决方案,大多数解决方案都是关于String.
String letter = enterletter.getText().toString();
char letterChar = letter.charAt(0);
if(letterChar == ' ' || letterChar == NULL) // this is where the code won't works
{
Toast.makeText(getApplicationContext(), "Please enter a letter!", Toast.LENGTH_LONG).show();
}
Run Code Online (Sandbox Code Playgroud)