1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Advocard [28]
3 years ago
8

What does the following code print?double[] myList = {1, 5, 5, 5, 5, 1};double max = myList[0];int indexOfMax = 0;for (int i = 1

; i < myList.length; i++) { if (myList[i] >= max) { max = myList[i]; indexOfMax = i; }}System.out.println(indexOfMax);
Computers and Technology
1 answer:
Liula [17]3 years ago
7 0

Answer:

This code will print: 4

Explanation:

Following is the step-by-step explanation for the given code:

  • Given is the array of data type double named myList, it has entries, 1, 5, 5, 5,5, 1:

                    double[] myList = {1, 5, 5, 5, 5, 1};

  • Now the first element of the array (1) with index 0 will be stored in the variable max (data type double).

                 double max = myList[0];  

  • A variable indexOfMax having datatype int will be initiated as 0.

                 int indexOfMax = 0;

  • Now for loop will be used to find the maximum number of the array. The variable i will be put as index for each element to compare with first element. If the checked element is greater than or equal to the integer in max, it will be replaced. So at the end the variable max will have value 5 that will be at index i = 4.

                    for (int i = 1; i < myList.length; i++)

                            { if (myList[i] >= max)

                               { max = myList[i];

  • Now the variable i that is the index for max value will be stored in the variable indexOfMax (indexOfMax = 4).

                  indexOfMax = i; }}

  • At end the value stored in variable indexOfMax will be printed, so 4 will be printed as output.

              System.out.println(indexOfMax);

i hope it will help you!

You might be interested in
A database, a database management system, and the application programs that use the data, make up a database environment.
BlackZzzverrR [31]

Answer:

A) The statement is true

8 0
3 years ago
Which of the following could result from heat being transferred to a substance?
lbvjy [14]

Answer: i dont see the following sorry cant help ya

Explanation:

8 0
3 years ago
Which of the following information sources was not directly affected by the Telecommunications Act of 1996?
VMariaS [17]
Apparently, the answer is newspaper publishing.

Since telecommunication is defined to use wireless and electrical protocols to transmit data.
6 0
3 years ago
1. What is wrong with the following code?
uranmaximum [27]

Answer:

Aye dog I don't know nothing about code, yes its true, but I hope that you get an answer for you!

Explanation:

Facts...

5 0
3 years ago
An online survey is an effective way for an administrative professional to gather information. True False
Strike441 [17]

Answer:

True is the correct answer for the above question.

Explanation:

  • An online survey is done with the help of social sites that connects many people in conversation from all over the world. So to do an effective survey, it is best to choose the online medium.
  • The administrative professional is a professional, who works to do administrative tasks like managing the organization.
  • The above question-statement says that the online survey is the best survey, which is the correct statement, which is described above. Hence the answer is true for the above question.
7 0
3 years ago
Other questions:
  • Which view In a presentation program displays you’re slides in full screen modes ?
    8·2 answers
  • Write a full class definition for a class named Averager, and containing the following members:______An data member named sum of
    6·2 answers
  • Which of the following is an example of a direct payment subsidy?
    12·1 answer
  • All systems have ___________.
    9·2 answers
  • Supp guees how your dayyyyyyyyyyyy
    10·2 answers
  • Which type of protocol allows for a secure data transmission using encryption methods?
    7·1 answer
  • The average American has 10 devices, ask for users average number of devices. Any number between 7 and 12 will print “you have a
    13·1 answer
  • Which of the following statements about ip addresses is true?
    5·1 answer
  • Please help me.
    8·2 answers
  • I have all of the points and brainliest, but it won't level up, I don't know why, anyone know why?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!