以下の明解java List6-16で以下のプログラムをEclipseで実行時にエラーになりますが、原因がわかりません。
お分かりになる方ご教授願います。
エラーの内容は太字行の【i】【j】を変数に解決できませんと出ます。
import java.util.Scanner; import java.util.Random; public class L616 { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner abc = new Scanner(System.in); Random rand = new Random(); System.out.print("行数:"); int h = abc.nextInt(); System.out.print("列数:"); int w = abc.nextInt(); int[][] x = new int[h][w]; for(int i = 0; i < h; i++) for(int j = 0; j < w; j++) x[i][j] = rand.nextInt(100); **System.out.println("x[" + i +"][" + j + "] = " + x[i][j]);** } } コード
回答1件
あなたの回答
tips
プレビュー