Answer the question
In order to leave comments, you need to log in
How to add a second array to the output in columns?
Good evening!
It is not possible to display both arrays, only one at a time. :-(
public class Marathon {
public static String[] printResults(String[] names) {
for (int i = 0; i < names.length; i++) {
System.out.println(names[i]);
}
return names;
}
public static void main(String args[]) {
String[] names = { "Elena", "Thomas", "Hamilton", "Suzie", "Phil", "Matt", "Alex", "Emma", "John", "James", "Jane", "Emily", "Daniel", "Neda", "Aaron", "Kate" };
int[] times= { 341, 273, 278, 329, 445, 402, 388, 275, 243, 334, 412, 393, 299, 343, 317, 265 };
System.out.println("+----------+----------+" );
System.out.println("|---NAME---|--RESULT--|" );
System.out.println("+----------+----------+" );
printResults(names);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question