Advertisement
thenewboston

Java Programming Tutorial - 34 - Table for Multi Arrays

Aug 22nd, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. public class apples {
  2.    public static void main (String[] args){
  3.       int firstarray[][] = {{8,9,10,11},{12,13,14,15}};
  4.       int secondarray[][] = {{30,31,32,33},{43},{4,5,6}};
  5.      
  6.       System.out.println("This is the first array");
  7.       display(firstarray);
  8.      
  9.       System.out.println("This is the second array");
  10.       display(secondarray);
  11.    }
  12.    
  13.    public static void display (int x [][]){
  14.       for(int row=0;row <x.length;row++){
  15.          for(int column=0;column < x[row].length;column++){
  16.             System.out.print(x[row][column]+"\t");
  17.          }
  18.          System.out.println();
  19.       }
  20.    }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement