सीधे मुख्य सामग्री पर जाएं

#36 Write a program for 2D Array in Java | 2D Array in Java

package com.sudhirtheindian2.java123;

import java.util.Scanner;

public class twoDarray {
public static void main(String[] args) {

// How to use 2D array in java

int[][] a =new int[2][2];
System.out.println("enter your array element");
Scanner scanner = new Scanner(System.in);
for (int i = 0; i<2;i++){
for (int j=0;j<2;j++){
a[i][j] = scanner.nextInt();
}
}


for (int i = 0; i<2;i++){
for (int j=0;j<2;j++){
System.out.print(a[i][j]+" ");
}
System.out.println();
}


}
}

टिप्पणियाँ

इस ब्लॉग से लोकप्रिय पोस्ट