新手求教input cannot be resolved
inputStr cannot be resolvedposStrArr cannot be resolved
posStrArr cannot be resolved
怎么解决这个错误,这个包我找不到啊,大神。inputStr cannot be resolved
搜索更多相关的解决方案:
cannot
----------------解决方案--------------------------------------------------------
你发个这个过来,我们怎么看的懂?
把整个程序发出来呀!
----------------解决方案--------------------------------------------------------
回复 2楼 Kingbox_tang
import java.awt.event.InputEvent;import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Gobang
{
private String[][] board;
private static int BOARD_SIZE=15;
public void initBoard()
{
board=new String[BOARD_SIZE][BOARD_SIZE];
for(int i=0;i<BOARD_SIZE;i++)
{
for(int j=0;j<BOARD_SIZE;j++)
{
board[i][j]="╋";
}
}
}
public void printBoard()
{
for(int i=0;i<BOARD_SIZE;i++)
{
for(int j=0;j<BOARD_SIZE;j++)
{
System.out.print(board[i][j]);
}
System.out.print("\n");
}
}
public static void main(String[] args) throws Exception
{
Gobang bg=new Gobang();
bg.initBoard();
bg.printBoard();
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String inputstr=null;
while((inputstr=br.readLine())!=null)
{
String[] possStrArr=InputEvent.split(",");
int xPos=Integer.parseInt(posStrArr[0]);
int yPos=Integer.parseInt(posStrArr[1]);
bg.board[yPos-1][xPos-1]="●";
bg.printBoard();
System.out.println("请乱来,应格式为:");
}
}
}
其实是李刚的疯狂JAVA讲义上的简易五子棋,但是课本没有import任何包,我加了两个,但是还有问题
----------------解决方案--------------------------------------------------------