public class Main
{
// create and output two-dimensional arrays
public static void main(String[] args)
/*
from 时 代 J a v a 公 众 号 - nowjava.com
*/
{
int[][] array1 = {{1, 2, 3}, {4, 5, 16}};
int[][] array2 = {{11, 12}, {13}, {14, 5, 6}};
System.out.println("Values in array1 by row are");
outputArray(array1); // displays array1 by row
System.out.printf("%nValues in array2 by row are%n");
outputArray(array2); // displays array2 by row
}
/**
* 时代Java 提 供
**/
// output rows and columns of a two-dimensional array
public static void outputArray(int[][] array)
{
// loop through array's rows
for (int row = 0; row < array.length; row++)
{
// loop through columns of current row
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。