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 29 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
Great answer, keep it coming :)


adf223

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

 

Did you know?

Most childhood vaccines are 90–99% effective in preventing disease. Side effects are rarely serious.

Did you know?

The immune system needs 9.5 hours of sleep in total darkness to recharge completely.

Did you know?

The average person is easily confused by the terms pharmaceutics and pharmacology, thinking they are one and the same. Whereas pharmaceutics is the science of preparing and dispensing drugs (otherwise known as the science of pharmacy), pharmacology is the study of medications.

Did you know?

Vital signs (blood pressure, temperature, pulse rate, respiration rate) should be taken before any drug administration. Patients should be informed not to use tobacco or caffeine at least 30 minutes before their appointment.

Did you know?

The training of an anesthesiologist typically requires four years of college, 4 years of medical school, 1 year of internship, and 3 years of residency.

For a complete list of videos, visit our video library