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

Author Question: Which of the following is correct to create an array? (Read 28 times)

sam.t96

  • Hero Member
  • *****
  • Posts: 570

Question 1

What is the output of the following code?

int[] myList = {1, 2, 3, 4, 5, 6};
for (int i = 1; i < myList.length; i++) {
myList[i - 1] = myList[i];
}

for (int e: myList)
System.out.print(e + " ");

◦ 2 3 4 5 6 6
◦ 6 1 2 3 4 5
◦ 6 2 3 4 5 1
◦ 2 3 4 5 6 1
◦ 1 2 3 4 5 6

Question 2

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


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by sam.t96 on May 6, 2020

ririgirl15

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




sam.t96

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


miss_1456@hotmail.com

  • Member
  • Posts: 289
Reply 3 on: Yesterday
Great answer, keep it coming :)

 

Did you know?

Warfarin was developed as a consequence of the study of a strange bleeding disorder that suddenly occurred in cattle on the northern prairies of the United States in the early 1900s.

Did you know?

Egg cells are about the size of a grain of sand. They are formed inside of a female's ovaries before she is even born.

Did you know?

Russia has the highest death rate from cardiovascular disease followed by the Ukraine, Romania, Hungary, and Poland.

Did you know?

Patients who have undergone chemotherapy for the treatment of cancer often complain of a lack of mental focus; memory loss; and a general diminution in abilities such as multitasking, attention span, and general mental agility.

Did you know?

In 2010, opiate painkllers, such as morphine, OxyContin®, and Vicodin®, were tied to almost 60% of drug overdose deaths.

For a complete list of videos, visit our video library