-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTwoDimensionalArrayExample.java
41 lines (40 loc) · 1.48 KB
/
TwoDimensionalArrayExample.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import java.util.Scanner;
public class TwoDimensionalArrayExample {
public static void main(String args[]){
Scanner input= new Scanner(System.in);
System.out.println("enter a word.");
String input0=input.nextLine();
System.out.println("enter a word.");
String input1= input.nextLine();
System.out.println("enter a word.");
String input2= input.nextLine();
System.out.println("enter a word.");
String input3=input.nextLine();
System.out.println("enter a word.");
String input4= input.nextLine();
System.out.println("enter a word.");
String input5= input.nextLine();
System.out.println("enter a word.");
String input6= input.nextLine();
System.out.println("enter a word.");
String input7= input.nextLine();
System.out.println("enter a word.");
String input8= input.nextLine();
String words[][]= new String[3][3];
words [0][0]=input0;
words [0][1]=input1;
words [0][2]=input2;
words [1][0]=input3;
words [1][1]=input4;
words [1][2]=input5;
words [2][0]=input6;
words [2][1]=input7;
words [2][2]=input8;
for (int i=0;i<3;i++){
System.out.println("---------------is starting to print---------------");
for (int j=0;j<3;j++){
System.out.println(words[i][j]);
}
}
}
}