java multidimensional string array
- From: "geletine" <adaviscg1@xxxxxxxxxxx>
- Date: 5 May 2006 06:00:35 -0700
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[i][0]);
}
}
when i run it it prints
player1
name1
if i change the line System.out.println(strings[i][0]); to
System.out.println(strings[i][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[i][0]); to
System.out.println(strings[i][0]+ strings[i][1]);
prints this
player1player2
name1name2
which is not what i would like to see
could anyone help?
thanks in advance
.
- Follow-Ups:
- Re: java multidimensional string array
- From: Simon
- Re: java multidimensional string array
- Prev by Date: Re: Difference B/w JRE or JDK
- Next by Date: problem in java swings
- Previous by thread: Difference B/w JRE or JDK
- Next by thread: Re: java multidimensional string array
- Index(es):