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


irishcancer18

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

 

Did you know?

The first successful kidney transplant was performed in 1954 and occurred in Boston. A kidney from an identical twin was transplanted into his dying brother's body and was not rejected because it did not appear foreign to his body.

Did you know?

Only one in 10 cancer deaths is caused by the primary tumor. The vast majority of cancer mortality is caused by cells breaking away from the main tumor and metastasizing to other parts of the body, such as the brain, bones, or liver.

Did you know?

Disorders that may affect pharmacodynamics include genetic mutations, malnutrition, thyrotoxicosis, myasthenia gravis, Parkinson's disease, and certain forms of insulin-resistant diabetes mellitus.

Did you know?

According to the National Institute of Environmental Health Sciences, lung disease is the third leading killer in the United States, responsible for one in seven deaths. It is the leading cause of death among infants under the age of one year.

Did you know?

Street names for barbiturates include reds, red devils, yellow jackets, blue heavens, Christmas trees, and rainbows. They are commonly referred to as downers.

For a complete list of videos, visit our video library