G
geletine
I have this elementary short piece of code that works
import java.io.*;
public class filearray {
public static void main(String args [])throws IOException {
String [] [] strings = { { "player1",
"player2",
"player3",
"player4",
"player5",
"player6" },
{"name1",
"name2",
"name3",
"name4",
"name5",
"name6" }
};
for (int i=0; i<strings.length; i++)
System.out.println(strings[0]);
}
}
when i run it it prints
player1
name1
if i change the line System.out.println(strings[0]); to
System.out.println(strings[5]);
it will print
player6
name6
and i can change the print line to diffrent values to print different
positions in the array, i would like to print all sets in one line so
it gives a output like the following.
player1
name1
player2
name2
......
player6
name6
changing System.out.println(strings[0]); to
System.out.println(strings[0]+ strings[1]);
prints this
player1player2
name1name2
which is not what i would like to see
could anyone help?
thanks in advance
import java.io.*;
public class filearray {
public static void main(String args [])throws IOException {
String [] [] strings = { { "player1",
"player2",
"player3",
"player4",
"player5",
"player6" },
{"name1",
"name2",
"name3",
"name4",
"name5",
"name6" }
};
for (int i=0; i<strings.length; i++)
System.out.println(strings[0]);
}
}
when i run it it prints
player1
name1
if i change the line System.out.println(strings[0]); to
System.out.println(strings[5]);
it will print
player6
name6
and i can change the print line to diffrent values to print different
positions in the array, i would like to print all sets in one line so
it gives a output like the following.
player1
name1
player2
name2
......
player6
name6
changing System.out.println(strings[0]); to
System.out.println(strings[0]+ strings[1]);
prints this
player1player2
name1name2
which is not what i would like to see
could anyone help?
thanks in advance