ご質問ありがとうございます。 ここにもう一つ問題があります。私は例外があります java.lang.ArrayIndexOutOfBoundsException:0配列を書き込むとき0 ArrayBooleanjava.lang.ArrayIndexOutOfBoundsExceptionとは何ですか?0?
私はGoogleで見つけようとしましたができませんでした。 もしあなたが私を共有して知っている。
ご質問ありがとうございます。 ここにもう一つ問題があります。私は例外があります java.lang.ArrayIndexOutOfBoundsException:0配列を書き込むとき0 ArrayBooleanjava.lang.ArrayIndexOutOfBoundsExceptionとは何ですか?0?
私はGoogleで見つけようとしましたができませんでした。 もしあなたが私を共有して知っている。
空の配列に書き込むことを意味します。
ArrayIndexOutOfBoundsException
のjavadocのから:
* Thrown to indicate that an array has been accessed with an
* illegal index. The index is either negative or greater than or
* equal to the size of the array.
ので、0はあなたの配列の> =サイズですので、あなたの配列は空です。
それは本質的に、意味:
int[] array = new int[0];
array[0] = 0;
をしかしnumが、ユーザからの入力数です。私は16を入れればどうですか?それは空ではありません?しかし、それは私にエラーを与える。 – Cando
@Candoはあなたのコードを投稿します – dantuch
Aan ok。わかった。どうもありがとうございました。 – Cando