Monday, 5 October 2015

Two dimensional string array in java

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

/**
* @param args
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String array[][] = new String[3][4];
for(int i=0;i<3;i++){
for(int j=0;j<4;j++){
array[i][j] = br.readLine();

}

}
for(int m=0;m<3;m++){
for(int n=0;n<4;n++){
System.out.println("The name of the Person is " +array[m][n]);

}

}

int k=array.length;
System.out.println("The length is " +k);
}

}


Output:-
Sai
Nagendra
Bhavani
Prasad
Battipati
Chinna
Chaya
Krishna
Prameela
Bindhu
Ravi
Kumar
The name of the Person is Sai
The name of the Person is Nagendra
The name of the Person is Bhavani
The name of the Person is Prasad
The name of the Person is Battipati
The name of the Person is Chinna
The name of the Person is Chaya
The name of the Person is Krishna
The name of the Person is Prameela
The name of the Person is Bindhu
The name of the Person is Ravi
The name of the Person is Kumar
The length is 3


No comments:

Post a Comment