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 45 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
Excellent


bulacsom

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

 

Did you know?

Autoimmune diseases occur when the immune system destroys its own healthy tissues. When this occurs, white blood cells cannot distinguish between pathogens and normal cells.

Did you know?

Interferon was scarce and expensive until 1980, when the interferon gene was inserted into bacteria using recombinant DNA technology, allowing for mass cultivation and purification from bacterial cultures.

Did you know?

Although the Roman numeral for the number 4 has always been taught to have been "IV," according to historians, the ancient Romans probably used "IIII" most of the time. This is partially backed up by the fact that early grandfather clocks displayed IIII for the number 4 instead of IV. Early clockmakers apparently thought that the IIII balanced out the VIII (used for the number 8) on the clock face and that it just looked better.

Did you know?

There are approximately 3 million unintended pregnancies in the United States each year.

Did you know?

Less than one of every three adults with high LDL cholesterol has the condition under control. Only 48.1% with the condition are being treated for it.

For a complete list of videos, visit our video library