所以基本上,如果输入是1,我需要在我的数组中打印12个给定的数字,如果输入是
2,我需要打印随机数。格式应如下所示,一行8,块间距为5,底部为4。
1 2 3 4 5 6 7 8
9 10 11 12
all the 12 numbers will be in the same array but the output must be like this.
and if the input is 2, the array must output 12 random numbers
all i know and read in the book is something like this to print nomally
System.out.printf(Arrays.toString(array));
if (i == 1){
System.out.printf("%5s", Arrays.toString(array)) ;
}
int i = input.nextInt();
int[] array = {1,2,3,4,5,6,7,8,9,10,11,12};
System.out.printf(Arrays.toString(array));
if (i == 1){
System.out.printf("%5s", Arrays.toString(array)) ;
}
I wanted the print to be >1 2 3 4 5 6 7 8 /n 9 10 11 12
but the output is within sets {}
哔哔one
忽然笑
相关分类