私はすでに次のコードを持っています
public class Qn3
{
static BigDecimal[] accbal= new BigDecimal[20];
private static Integer[] accnums = new Integer[5];
public static void main(String[] args)
{
int count;
accnums = {1,2} //i cant add this line of code as well, what is wrong?
while(accnums.length < 5)
{
count = accnums.number_of_filled_up_indexes
//this is not actual code i know
//do this as the number of values in the array are less than 5
break;
}
//do this as number of values in the array are more than 5
}
}
私はこのコードを使用する必要があります。これは必須ですので、arraylistなどの使用を提案しないでください(他の配列タイプとメソッドを知っています)
問題は、私がすでに宣言したようにaccnums
、事前定義された5つの値のみを含める必要があることです。
nullではないものとすべてがnullであるかどうかのチェックを実行しようとしています。これを行うために私はこれを試しましたが、これは私に5 p(私が望むものではない事前定義された整数配列値)を与えています。