public class ArrayR71A
{
public static void main(String [] args)
{
int[] myNums = new int[10];
for (int i = 0; i < myNums.length; i++)
{
myNums[i] = i + 1;
System.out.print(myNums[i] + " ");
}
}
}
它目前打印出1 2 3 4 5 6 7 8 9 10,但是修改它以打印序列的最快方法是0 1 0 1 0 1 0 1 0 1?
答案 0 :(得分:0)
将作业行更改为:
myNums[i] = i % 2;