This topic contains a solution. Click here to go to the answer

Author Question: What is the output of the following code?double[] myList = {1, 5, 5, 5, 5, 1};double max = ... (Read 24 times)

acc299

  • Hero Member
  • *****
  • Posts: 569

Question 1

Which of the following declarations are correct?
◦ int[] list = new int[]{1, 2, 3, 4};
◦ int[4] list = new int{1, 2, 3, 4};
◦ int[] list = {1, 2, 3, 4};
◦ int[] list = new int{1, 2, 3, 4};

Question 2

What is the output of the following code?

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

◦ 0
◦ 1
◦ 2
◦ 3
◦ 4


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by acc299 on May 6, 2020

wshriver

  • Sr. Member
  • ****
  • Posts: 318
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 39% of students answer this correctly




acc299

  • Member
  • Posts: 569
Reply 2 on: May 6, 2020
Excellent


parker125

  • Member
  • Posts: 332
Reply 3 on: Yesterday
:D TYSM

 

Did you know?

More than 4.4billion prescriptions were dispensed within the United States in 2016.

Did you know?

The Centers for Disease Control and Prevention (CDC) was originally known as the Communicable Disease Center, which was formed to fight malaria. It was originally headquartered in Atlanta, Georgia, since the Southern states faced the worst threat from malaria.

Did you know?

Thyroid conditions may make getting pregnant impossible.

Did you know?

Approximately one in four people diagnosed with diabetes will develop foot problems. Of these, about one-third will require lower extremity amputation.

Did you know?

Over time, chronic hepatitis B virus and hepatitis C virus infections can progress to advanced liver disease, liver failure, and hepatocellular carcinoma. Unlike other forms, more than 80% of hepatitis C infections become chronic and lead to liver disease. When combined with hepatitis B, hepatitis C now accounts for 75% percent of all cases of liver disease around the world. Liver failure caused by hepatitis C is now leading cause of liver transplants in the United States.

For a complete list of videos, visit our video library