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

Author Question: What is the printout of the following program?public class Test { public static void main(String[] ... (Read 36 times)

Marty

  • Hero Member
  • *****
  • Posts: 553

Question 1

What is the printout of the following program?

public class Test {
public static void main(String[] args) {
int[][] values = {{3, 4, 5, 1}, {33, 6, 1, 2}};
int v = values[0][0];
for (int[] list : values)
for (int element : list)
if (v > element)
v = element;
System.out.print(v);
}
}

◦ 3
◦ 33
◦ 5
◦ 1
◦ 6

Question 2

What is the printout of the following program?

public class Test {
public static void main(String[] args) {
int[][] values = {{3, 4, 5, 1 }, {33, 6, 1, 2}};
for (int row = 0; row < values.length; row++) {
java.util.Arrays.sort(values[row]);
for (int column = 0; column < values[row].length; column++)
System.out.print(values[row][column] + " ");
System.out.println();
}
}
}

◦ The program prints on row 3 4 5 1 33 6 1 2
◦ The program prints two rows 1 3 4 5 followed by 1 2 6 33
◦ The program prints one row 1 3 4 5 1 2 6 33
◦ The program prints two rows 3 4 5 1 followed by 33 6 1 2


Related Topics

Need homework help now?

Ask unlimited questions for free

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

Alyson.hiatt@yahoo.com

  • Sr. Member
  • ****
  • Posts: 354
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




Marty

  • Member
  • Posts: 553
Reply 2 on: May 6, 2020
:D TYSM


irishcancer18

  • Member
  • Posts: 310
Reply 3 on: Yesterday
YES! Correct, THANKS for helping me on my review

 

Did you know?

The National Institutes of Health have supported research into acupuncture. This has shown that acupuncture significantly reduced pain associated with osteoarthritis of the knee, when used as a complement to conventional therapies.

Did you know?

Sildenafil (Viagra®) has two actions that may be of consequence in patients with heart disease. It can lower the blood pressure, and it can interact with nitrates. It should never be used in patients who are taking nitrates.

Did you know?

The heart is located in the center of the chest, with part of it tipped slightly so that it taps against the left side of the chest.

Did you know?

According to animal studies, the typical American diet is damaging to the liver and may result in allergies, low energy, digestive problems, and a lack of ability to detoxify harmful substances.

Did you know?

Women are two-thirds more likely than men to develop irritable bowel syndrome. This may be attributable to hormonal changes related to their menstrual cycles.

For a complete list of videos, visit our video library