Ask Question
15 August, 21:21

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; }}

+1
Answers (1)
  1. 16 August, 00:14
    0
    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.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write three statements to print the first three elements of array runTimes. Follow each statement with a newline. Ex: If runTime = {800, ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers