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 20 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


T4T

  • Member
  • Posts: 348
Reply 3 on: Yesterday
:D TYSM

 

Did you know?

In 1885, the Lloyd Manufacturing Company of Albany, New York, promoted and sold "Cocaine Toothache Drops" at 15 cents per bottle! In 1914, the Harrison Narcotic Act brought the sale and distribution of this drug under federal control.

Did you know?

All patients with hyperparathyroidism will develop osteoporosis. The parathyroid glands maintain blood calcium within the normal range. All patients with this disease will continue to lose calcium from their bones every day, and there is no way to prevent the development of osteoporosis as a result.

Did you know?

Liver spots have nothing whatsoever to do with the liver. They are a type of freckles commonly seen in older adults who have been out in the sun without sufficient sunscreen.

Did you know?

The horizontal fraction bar was introduced by the Arabs.

Did you know?

Human neurons are so small that they require a microscope in order to be seen. However, some neurons can be up to 3 feet long, such as those that extend from the spinal cord to the toes.

For a complete list of videos, visit our video library