Question: In this chapters FlightTimes class, modify the displayFlightTimesTable method by converting the two for loops that iterate over the columns, so that they use for-each
In this chapter’s FlightTimes class, modify the displayFlightTimesTable method by converting the two for loops that iterate over the columns, so that they use for-each loops instead.
There’s no comparable benefit to converting the for loop that iterates over the rows. Why? Because if it’s converted to a for-each loop, then there’s no row index variable, and that variable is needed later on as an index into the cities array:
System.out.printf(CITY_FMT_STR, cities[row]);
Step by Step Solution
3.51 Rating (148 Votes )
There are 3 Steps involved in it
If you need the row index variable later in your code you should keep the for loop iterating over th... View full answer
Get step-by-step solutions from verified subject matter experts
