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

Author Question: Identify the problems in the following code. public class Test { public static void main(String ... (Read 23 times)

danielfitts88

  • Hero Member
  • *****
  • Posts: 535

Question 1

Which correctly creates an array of five empty Strings?
◦ String[] a = new String [5];
◦ String[] a = {"", "", "", "", ""};
◦ String[ ] a = new String [5]; for (int i = 0; i < 5; a[i++] = null);
◦ String[5] a;

Question 2

Identify the problems in the following code.
 
public class Test {
public static void main(String argv[]) {
System.out.println("argv.length is " + argv.length);
}
}

◦ The program has a compile error because String args[] is wrong and it should be replaced by String args[].
◦ The program has a compile error because String argv[] is wrong and it should be replaced by String[] args.
◦ If you run this program without passing any arguments, the program would display argv.length is 0.
◦ If you run this program without passing any arguments, the program would have a runtime error because argv is null.


Related Topics

Need homework help now?

Ask unlimited questions for free

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

braelync

  • Sr. Member
  • ****
  • Posts: 350
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 56% of students answer this correctly




danielfitts88

  • Member
  • Posts: 535
Reply 2 on: May 6, 2020
YES! Correct, THANKS for helping me on my review


DylanD1323

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

 

Did you know?

Nearly 31 million adults in America have a total cholesterol level that is more than 240 mg per dL.

Did you know?

More than 150,000 Americans killed by cardiovascular disease are younger than the age of 65 years.

Did you know?

Multiple sclerosis is a condition wherein the body's nervous system is weakened by an autoimmune reaction that attacks the myelin sheaths of neurons.

Did you know?

Since 1988, the CDC has reported a 99% reduction in bacterial meningitis caused by Haemophilus influenzae, due to the introduction of the vaccine against it.

Did you know?

Drug-induced pharmacodynamic effects manifested in older adults include drug-induced renal toxicity, which can be a major factor when these adults are experiencing other kidney problems.

For a complete list of videos, visit our video library