technoknow
Technical User
public class MyArray
{
public static void main(String args[]) throws Exception
{
int i; int j;
String[][] friends =
{ {"Dave", "Henrich", "33"},
{"Jim", "Creighton", "42"},
{"Bob", "Wilson", "47"} };
for (i = 0; i< friends.length; i++)
for (j = 0; j < friends.length; j++)
System.out.println(friends[j]);
}
}
I'm trying to print this array with each row on 1 line like this:
Dave Henrich 33
Jim Creighton 42
Bob Wilson 47
But it comes out like this:
Dave
Henrich
33
Jim etc....
What am I doing wrong?
Thanks,
{
public static void main(String args[]) throws Exception
{
int i; int j;
String[][] friends =
{ {"Dave", "Henrich", "33"},
{"Jim", "Creighton", "42"},
{"Bob", "Wilson", "47"} };
for (i = 0; i< friends.length; i++)
for (j = 0; j < friends.length; j++)
System.out.println(friends[j]);
}
}
I'm trying to print this array with each row on 1 line like this:
Dave Henrich 33
Jim Creighton 42
Bob Wilson 47
But it comes out like this:
Dave
Henrich
33
Jim etc....
What am I doing wrong?
Thanks,