Skip to content

Instantly share code, notes, and snippets.

@rahulmalhotra
Created November 26, 2017 03:50
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/a18b4fb18325cb9b2fc4eef65a69837c to your computer and use it in GitHub Desktop.
Save rahulmalhotra/a18b4fb18325cb9b2fc4eef65a69837c to your computer and use it in GitHub Desktop.
Java program to make 2-D array without using new keyword
public class array {
public static void main(String[] args) {
int m2[][]={{1},{1,2},{1,2,3}};
System.out.println(m2[0][0]);
//System.out.println(m2[0][1]);
//System.out.println(m2[0][2]);
System.out.println(m2[1][0]);
System.out.println(m2[1][1]);
//System.out.println(m2[1][2]);
System.out.println(m2[2][0]);
System.out.println(m2[2][1]);
System.out.println(m2[2][2]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment