我已经有了以下代码
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个值,而这些值是预定义的。
我试图执行一个检查,不是空的,如果都是空的。要做到这一点,我试过这个,但这是给我5 p(预定义的整数数组值不是我想要的)。