Monday, 5 October 2015

Two dimensional array in java

/**
 *
 */
import java.io.*;
import java.util.*;
/**
 * @author U0123154
 *
 */
public class Twodimarry{

/**
* @param args
*/
public static void main(String[] args)  throws IOException {
// TODO Auto-generated method stub
int arry[][] = new int [3][4];
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
for(int i=0;i<3;i++){
for(int j=0;j<4;j++){
arry[i][j] = Integer.parseInt(br.readLine());
}
}
for (int k=0;k<3;k++){
for(int l=0;l<4;l++){
System.out.println("The value of the intefer is " +arry[k][l]);
}
}
int m = arry.length;
System.out.println("The array length is " +m);


}

}


Output:-
1
2
3
4
5
6
7
8
9
0
1
2
The value of the intefer is 1
The value of the intefer is 2
The value of the intefer is 3
The value of the intefer is 4
The value of the intefer is 5
The value of the intefer is 6
The value of the intefer is 7
The value of the intefer is 8
The value of the intefer is 9
The value of the intefer is 0
The value of the intefer is 1
The value of the intefer is 2
The array length is 3

No comments:

Post a Comment