/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package nilaiArrayPerBaris;
/**
*
* @author Angga
*/
public class nilaiArrayPerBaris {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int array1[][] = {{1,2,3},{4,5,6}};
int array2[][] = {{1,2},{3},{4,5,6}};
System.out.println(“nilai array1 per baris :”);
cetakArray(array1); //displays array1 by row
System.out.println(“\nnilai array2 per baris :”);
cetakArray(array2); //displays array2 by row
} //end main
public static void cetakArray(int array[][] ){
//loop through array’s rows
for (int row = 0; row < array.length; row++){
//loop through columns of current row
for ( int column = 0; column < array[ row ].length; column++)
System.out.printf(“%2s” , array [ row ][ column ]);
System.out.println(); //start new line of output
}
}
}