小编use*_*r26的帖子

如何修复java.lang.arrayindexoutofboundsexception:0?

我是新手java.任何人都可以帮我解决错误arrayindexoutofboundsexception.

public class Minesweeper { 
   public static void main(String[] args) { 

      int M = Integer.parseInt(args[0]);
      int N = Integer.parseInt(args[1]);
      double p = Double.parseDouble(args[2]);

      // game grid is [1..M][1..N], border is used to handle boundary cases
      boolean[][] bombs = new boolean[M+2][N+2];
      for (int i = 1; i <= M; i++)
         for (int j = 1; j <= N; j++)
            bombs[i][j] = (Math.random() < p);

      // print game
      for (int i = 1; i <= M; i++) { …
Run Code Online (Sandbox Code Playgroud)

java

3
推荐指数
2
解决办法
3万
查看次数

标签 统计

java ×1