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 26 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
Wow, this really help


cassie_ragen

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

 

Did you know?

ACTH levels are normally highest in the early morning (between 6 and 8 A.M.) and lowest in the evening (between 6 and 11 P.M.). Therefore, a doctor who suspects abnormal levels looks for low ACTH in the morning and high ACTH in the evening.

Did you know?

By definition, when a medication is administered intravenously, its bioavailability is 100%.

Did you know?

Earwax has antimicrobial properties that reduce the viability of bacteria and fungus in the human ear.

Did you know?

GI conditions that will keep you out of the U.S. armed services include ulcers, varices, fistulas, esophagitis, gastritis, congenital abnormalities, inflammatory bowel disease, enteritis, colitis, proctitis, duodenal diverticula, malabsorption syndromes, hepatitis, cirrhosis, cysts, abscesses, pancreatitis, polyps, certain hemorrhoids, splenomegaly, hernias, recent abdominal surgery, GI bypass or stomach stapling, and artificial GI openings.

Did you know?

Though Candida and Aspergillus species are the most common fungal pathogens causing invasive fungal disease in the immunocompromised, infections due to previously uncommon hyaline and dematiaceous filamentous fungi are occurring more often today. Rare fungal infections, once accurately diagnosed, may require surgical debridement, immunotherapy, and newer antifungals used singly or in combination with older antifungals, on a case-by-case basis.

For a complete list of videos, visit our video library