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

Author Question: Show the printout of the following code.public class Test { public static void main(String[] args) ... (Read 33 times)

Tirant22

  • Hero Member
  • *****
  • Posts: 532

Question 1

Which of the following is correct to create an array?
◦ int[][] m = {{1, 2}};
◦ int[][] m = {1, 2};
◦ int[][] m = {{1, 2}; {3, 4}};
◦ int[][] m = {{1, 2}, {3, 4}, };
◦ int[][] m = {{1, 2}, {3, 4}};

Question 2

Show the printout of the following code.

public class Test {
public static void main(String[] args) {
double[][] m = {{1, 2, 3}, {1.5, 2.5, 3.5}, {0.1, 0.1, 0.1}};
System.out.println(sum(m));
}
 
public static double sum(double[][] m) {
double sum = 0;
for (int i = 0; i < m.length; i++)
sum += m[i][i];
return sum;
}
}

◦ 4
◦ 3
◦ 3.6
◦ 3.0
◦ 4.0


Related Topics

Need homework help now?

Ask unlimited questions for free

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

nickk12214

  • Sr. Member
  • ****
  • Posts: 332
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 50% of students answer this correctly




Tirant22

  • Member
  • Posts: 532
Reply 2 on: May 6, 2020
Great answer, keep it coming :)


nguyenhoanhat

  • Member
  • Posts: 332
Reply 3 on: Yesterday
Thanks for the timely response, appreciate it

 

Did you know?

Hypertension is a silent killer because it is deadly and has no significant early symptoms. The danger from hypertension is the extra load on the heart, which can lead to hypertensive heart disease and kidney damage. This occurs without any major symptoms until the high blood pressure becomes extreme. Regular blood pressure checks are an important method of catching hypertension before it can kill you.

Did you know?

The tallest man ever known was Robert Wadlow, an American, who reached the height of 8 feet 11 inches. He died at age 26 years from an infection caused by the immense weight of his body (491 pounds) and the stress on his leg bones and muscles.

Did you know?

Limit intake of red meat and dairy products made with whole milk. Choose skim milk, low-fat or fat-free dairy products. Limit fried food. Use healthy oils when cooking.

Did you know?

In 2006, a generic antinausea drug named ondansetron was approved. It is used to stop nausea and vomiting associated with surgery, chemotherapy, and radiation therapy.

Did you know?

Complications of influenza include: bacterial pneumonia, ear and sinus infections, dehydration, and worsening of chronic conditions such as asthma, congestive heart failure, or diabetes.

For a complete list of videos, visit our video library