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 21 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
Excellent


bdobbins

  • Member
  • Posts: 326
Reply 3 on: Yesterday
Wow, this really help

 

Did you know?

The first oncogene was discovered in 1970 and was termed SRC (pronounced "SARK").

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?

In ancient Rome, many of the richer people in the population had lead-induced gout. The reason for this is unclear. Lead poisoning has also been linked to madness.

Did you know?

The tallest man ever known was Robert Wadlow, an American, who reached the height of 8 feet 11 inches. He died at age 26 years from an infection caused by the immense weight of his body (491 pounds) and the stress on his leg bones and muscles.

Did you know?

Adult head lice are gray, about ? inch long, and often have a tiny dot on their backs. A female can lay between 50 and 150 eggs within the several weeks that she is alive. They feed on human blood.

For a complete list of videos, visit our video library