码迷,mamicode.com
首页 > 编程语言 > 详细

Java练习题01

时间:2015-09-20 01:37:19      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:

问题:

利用二维非矩阵数组输出下面的数字

0

1 2

2 3 4

3 4 5 6

代码:

public class Page98{

????public static void main(String args[]){

????????int NumArray[][] = new int [4][];

????????NumArray[0]=new int[]{0};

????????NumArray[1]=new int[]{1,2};

????????NumArray[2]=new int[]{2,3,4};

????????NumArray[3]=new int[]{3,4,5,6};

????????

????????for(int i = 0; i < NumArray.length; i++){

????????????for(int j = 0; j < NumArray[i].length; j++){

????????????????System.out.print(" ");

????????????????System.out.print(NumArray[i][j]);????

????????????}

????????????System.out.println(" ");

????????}

????}

};

Java练习题01

标签:

原文地址:http://www.cnblogs.com/iucforever/p/4822663.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!