I have 3 String arrays. I want to print the all the 3 single arrays one after another in java. So like my 2 arrays look like-
o
ooo
ooooo
ooo
o
o o
ooooo
ooo
ooooo
o oo
I want to print each element of the array one after another (right next to eachother)
Current code result-
o
ooo
ooooo
ooo
o
o o
ooooo
ooo
ooooo
o oo
o o
ooo
ooooo
ooo
o
So expected output
o o o o o
ooo ooooo oooo
ooooo ooo oooo
ooo ooooo oooo
The output above may differ from inputs, but its just the sample I am showing . This is how I am expecting to print.
current code-
String[] tp1 = { " o ", " ooo ", "ooooo", " ooo ", " o " };
String[] tp2 = { " o o", "ooooo", " ooo ", "ooooo", " o oo" };
String[] tp3 = { " o o ", " ooo ", "ooooo", " ooo ", " o " };
List<String[]> values = new ArrayList<>();
values.add(tp1);
values.add(tp2);
values.add(tp3);
for (String[] strings : values) {
String output = "";
for (String string : strings) {
output += string;
output += "\n";
}
System.out.print(output);
}
System.out.println