378,547 views
35 votes
35 votes
In java, write three statements to print the first three elements of array runTimes. Follow each statement with a newline. Ex: If runTime = {800, 775, 790, 805, 808}, print:

800

775

790

In java, write three statements to print the first three elements of array runTimes-example-1
User Mark Armstrong
by
2.7k points

1 Answer

8 votes
8 votes

Answer:

public class PrintRunTimes {

public static void main(String[] args) {

int[] runTimes = {800, 775, 790, 805, 808};

for (int i = 0; i < 3; i++) {

System.out.println(runTimes[i]);

}

}

}

User Omajid
by
3.2k points