Skip to content

Instantly share code, notes, and snippets.

@rahulmalhotra
Created November 26, 2017 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahulmalhotra/7b46d8245fe31e2bee2fe5508bd55b42 to your computer and use it in GitHub Desktop.
Save rahulmalhotra/7b46d8245fe31e2bee2fe5508bd55b42 to your computer and use it in GitHub Desktop.
Java program to make 2-D Array with different columns for each row.
public class array {
public static void main(String[] args) {
int m1[][]=new int[2][];
m1[0]=new int[1];
m1[1]=new int[2];
m1[0][0]=1;
//m1[0][1]=2;
m1[1][0]=3;
m1[1][1]=4;
System.out.println(m1[0][0]);
//System.out.println(m1[0][1]);
System.out.println(m1[1][0]);
System.out.println(m1[1][1]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment