87.0k views
0 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

1 Answer

5 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 Muneeba
by
5.2k points