如何初始化单个元素为真而不是初始化整个数组。
do {
if (flightClass == 1) {
Arrays.fill(seats, true);
} else if (flightClass == 2) {
Arrays.fill(seats, true);
}
} while (i <= 10);
我的方法是这样做....
do {
if (flightClass == 1) {
int enterSeat = input.nextInt();
Arrays.fill(seats[enterSeat], true);
} else if (flightClass == 2) {
Arrays.fill(seats, true);
}
} while (i <= 10);
}