fork download
  1. import java.util.Scanner;
  2.  
  3. public class JavaProgram
  4. {
  5. public static void main(String args[])
  6. {
  7. int row, col, i, j;
  8. int arr[][] = new int[10][10];
  9. Scanner scan = new Scanner(System.in);
  10. int arr[][][] = new int[3][4][2];
  11. int i, j, k, num=1;
  12.  
  13.  
  14. System.out.println("YOU HAVE FOLLOWING CHOICES : ");
  15. System.out.println("1. 2d array ");
  16. System.out.println("2. 3d array ");
  17.  
  18. int i=s.nextInt();
  19.  
  20.  
  21. System.out.print("Enter Number of Row for Array (max 10) : ");
  22. row = scan.nextInt();
  23. System.out.print("Enter Number of Column for Array (max 10) : ");
  24. col = scan.nextInt();
  25.  
  26.  
  27. switch(i)
  28. {
  29. case 1:
  30.  
  31. System.out.print("Enter " +(row*col)+ " Array Elements : ");
  32. for(i=0; i<row; i++)
  33. {
  34. for(j=0; j<col; j++)
  35. {
  36. arr[i][j] = scan.nextInt();
  37. }
  38. }
  39.  
  40. System.out.print("The Array is :\n");
  41. for(i=0; i<row; i++)
  42. {
  43. for(j=0; j<col; j++)
  44. {
  45. System.out.print(arr[i][j]+ " ");
  46. }
  47. System.out.println();
  48.  
  49.  
  50. break;
  51.  
  52.  
  53.  
  54. case2:
  55.  
  56.  
  57. for(i=0; i<3; i++)
  58. {
  59. for(j=0; j<4; j++)
  60. {
  61. for(k=0; k<2; k++)
  62. {
  63. arr[i][j][k] = num;
  64. num++;
  65. }
  66. }
  67. }
  68.  
  69. for(i=0; i<3; i++)
  70. {
  71. for(j=0; j<4; j++)
  72. {
  73. for(k=0; k<2; k++)
  74. {
  75. System.out.print("arr[" +i+ "][" +j+ "][" +k+ "] = " +arr[i][j][k]+ "\t");
  76. }
  77. System.out.println();
  78. }
  79. System.out.println();
  80.  
  81. break;
  82.  
  83. }
  84. default:
  85. system.out.println("invalid choice");
  86.  
  87.  
  88. }
  89. system.out.println("array"+array);
  90. }
  91.  
  92.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:84: error: orphaned default
default:
^
Main.java:90: error: reached end of file while parsing
}
 ^
2 errors
stdout
Standard output is empty