我的项目终于完成了,但我唯一的问题是我的老师不接受我们代码中的“中断”.有人可以帮我解决这个问题,我已经做了好几天了,我似乎无法让程序在不使用它们的情况下工作.中断位于我的DropYellowDisk和DropRedDisk方法中.除了那个问题,我的连接四个程序是完美无缺的.
private static void DropYellowDisk(String[][] grid) { int number = 0; Scanner keyboard = new Scanner (System.in); System.out.println("Drop a yellow disk at column (1–7): "); int c = 2*keyboard.nextInt()+1; for (int i=6;i>=0;i--) { if (grid[i][c] == " ") { grid[i][c] = "Y"; break; }} } private static void DropRedDisk(String[][] grid) { Scanner keyboard = new Scanner (System.in); System.out.print("Drop a red disk at column (1–7): "); int c = 2*keyboard.nextInt()+1; for (int i =6;i>=0;i--) { if (grid[i][c] == " ") { grid[i][c] = "R"; break; } }}