cfnr.net
当前位置:首页 >> jAvA如何换行打印二维数组,例如 1 2 3 4 5 6 7 8 9 >>

jAvA如何换行打印二维数组,例如 1 2 3 4 5 6 7 8 9

实现代码 结果

package com.test; public class Test { public static void main(String[] args) { final int[] is = new int[] { 1, 3, 6, 10, 15, 2, 5, 9, 14, 4, 8, 13, 7, 12, 11 }; int index = 0; for (int i = 5; i > 0; i--) { for (int j = 0; j < i...

public class Qhuanhang { public static void main(String[] args) { int[] num = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; int count=0; for (int i = 0; i < num.length; i++) { System.out.print(num[i]+" "); if(++count%5==0) System.o...

char word2[3][4]; //这个 3,4,最好是先查找字串word,判断最大长度; 和最大行数; //这里我们假设 word是规则的; int i = 0,j = 0,n = 0; while(word[n]) { if(word[n] == '#') {i++,j=0;continue;} word2[i][j] = word[n]; j++; n++; }

网站首页 | 网站地图
All rights reserved Powered by www.cfnr.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com