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 790import java.util.Scanner;public class PrintRunTimes {public static void main (String [] args) {int[] runTimes = new int[5];// Populate arrayrunTimes[0] = 800;runTimes[1] = 775;runTimes[2] = 790;runTimes[3] = 805;runTimes[4] = 808;/* Your solution goes here */return;}}

Respuesta :

Limosa

Answer:

Following are the code in the Java Programming Language.

//print first element of the array

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

//Print second element of the array

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

//print third element of the array

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

Explanation:

Following are the description of the Program:

In the above program, There is the integer type array variable that is 'runTimes' and its index value is 5. Then, initialize values in the array one by one which means firstly, they insert in index 0, then in index 1, and so on. Finally, we have to print the first three elements of the array. So, we set the System.out.println() function three times to print array by passing array name and first three index value with it.

Print statements are used to display statements and expressions in a program.

The three print statements are:

  • System.out.println(arrayrunTimes[0]);
  • System.out.println(arrayrunTimes[1]);
  • System.out.println(arrayrunTimes[2]);

The above statements are straightforward; however, we need to take not of the following highlights.

The question says, the print statement should print a new line, after printing each array element.

This can be achieved using System.out.println() or System.out.print('\n').

In this program, we used the former.

Also, array elements start its indices from 0.

This means that, the first element of the array is at index 0, the second is at index 1, and so on.

Read more about similar programs at:

https://brainly.com/question/7182610