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]
2 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]2 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
Which image file format is an uncompressed raster file which may contain different depths of color depths per pixel, or may be s
dangina [55]

Answer:

BMP

Explanation:

The BMP file format, also known as bitmap image file, device independent bitmap (DIB) file format and bitmap, is a raster graphics image file format used to store bitmap digital images, independently of the display device (such as a graphics adapter), especially on Microsoft Windows[2] and OS/2[3] operating system

6 0
2 years ago
In codd's model of a relational database, data is stored in a(n) _____, which maintains information about a(
Dmitry [639]
<span>Which is not a component of a database that describes how data is stored?</span>
5 0
3 years ago
Which of the following things would you access from the Program &amp; Courses page? Course descriptions Tutorial videos Account
Paraphin [41]

Course descriptions.

5 0
3 years ago
_____ allows information to be viewed at a glance without needing to address the individual elements of the information separate
blagie [28]

Spatial representation allows information to be viewed at a glance without needing to address the individual elements of the information separately or analytically.

<h3>What do you mean information?</h3>
  • Information is a stimulus with meaning for the receiver in a specific situation.
  • Data is a broad term that refers to information that is entered into and stored in a computer.
  • Data that has been processed, such as formatting and printing, can be interpreted as information again.
  • When you communicate verbally, nonverbally, graphically, or in writing, you are passing on knowledge gained through research, instruction, investigation, or reading the news.
  • Information is known by many different names, including intelligence, message, data, signal, and fact.
  • Information helps to avoid study duplication. Information stimulates the cognitive processes of users, particularly scholars.
  • Scientists, engineers, academics, and others benefit from the use of information.

To learn more about Information, refer to:

brainly.com/question/4231278

#SPJ4

5 0
1 year ago
Which element can be changed using the Print pane? Check all that apply.
Ronch [10]

Answer:

B

C

D

E

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • A friend has a CD of one of your favorite artists and has offered to let you copy it.
    8·1 answer
  • This toolbar has icons representing the application's basic operations such as Save and Copy. Drawing Formatting Standard Task
    11·2 answers
  • Which of the following is an unintended consequence of pesticide use on crops?
    10·1 answer
  • If you implement a Wireless LAN (WLAN) to support connectivity for laptops in the Workstation Domain, which domain does WLAN fal
    5·1 answer
  • Demographics refers to
    7·1 answer
  • What is the data type of the following expression?
    12·2 answers
  • What is the first step a user should take toward generating an index?
    7·1 answer
  • Question # 1 Multiple Select Which of the following shows the assignment of a string to a variable? Select 3 options. answer = "
    7·2 answers
  • Keeping memos on your checks is important because they
    12·1 answer
  • Which of the following statements is TRUE of a peer-to-peer network?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!