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


cici

  • Member
  • Posts: 325
Reply 3 on: Yesterday
Excellent

 

Did you know?

Nitroglycerin is used to alleviate various heart-related conditions, and it is also the chief component of dynamite (but mixed in a solid clay base to stabilize it).

Did you know?

Chronic marijuana use can damage the white blood cells and reduce the immune system's ability to respond to disease by as much as 40%. Without a strong immune system, the body is vulnerable to all kinds of degenerative and infectious diseases.

Did you know?

When blood is deoxygenated and flowing back to the heart through the veins, it is dark reddish-blue in color. Blood in the arteries that is oxygenated and flowing out to the body is bright red. Whereas arterial blood comes out in spurts, venous blood flows.

Did you know?

There are 60,000 miles of blood vessels in every adult human.

Did you know?

The National Institutes of Health have supported research into acupuncture. This has shown that acupuncture significantly reduced pain associated with osteoarthritis of the knee, when used as a complement to conventional therapies.

For a complete list of videos, visit our video library