Ask Question
13 February, 23:11

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

+3
Answers (1)
  1. 13 February, 23:23
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers