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 32 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
Thanks for the timely response, appreciate it


xiazhe

  • Member
  • Posts: 331
Reply 3 on: Yesterday
Wow, this really help

 

Did you know?

The newest statin drug, rosuvastatin, has been called a superstatin because it appears to reduce LDL cholesterol to a greater degree than the other approved statin drugs.

Did you know?

During pregnancy, a woman is more likely to experience bleeding gums and nosebleeds caused by hormonal changes that increase blood flow to the mouth and nose.

Did you know?

When blood is deoxygenated and flowing back to the heart through the veins, it is dark reddish-blue in color. Blood in the arteries that is oxygenated and flowing out to the body is bright red. Whereas arterial blood comes out in spurts, venous blood flows.

Did you know?

On average, the stomach produces 2 L of hydrochloric acid per day.

Did you know?

Increased intake of vitamin D has been shown to reduce fractures up to 25% in older people.

For a complete list of videos, visit our video library