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

Author Question: What is the output of the following code?public class Test { public static void main(String[] args) ... (Read 35 times)

joblessjake

  • Hero Member
  • *****
  • Posts: 555

Question 1

Which of the following statements is preferred to create a string "Welcome to Java"?
◦ String s = new String("Welcome to Java");
◦ String s; s = "Welcome to Java";
◦ String s = "Welcome to Java";
◦ String s; s = new String("Welcome to Java");

Question 2

What is the output of the following code?

public class Test {
public static void main(String[] args) {
String s1 = "Welcome to Java!";
String s2 = s1;
if (s1 == s2)
System.out.println("s1 and s2 reference to the same String object");
else
System.out.println("s1 and s2 reference to different String objects");
}
}

◦ s1 and s2 reference to the same String object
◦ s1 and s2 reference to different String objects


Related Topics

Need homework help now?

Ask unlimited questions for free

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

jennafosdick

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




joblessjake

  • Member
  • Posts: 555
Reply 2 on: May 6, 2020
:D TYSM


TheNamesImani

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

 

Did you know?

The first documented use of surgical anesthesia in the United States was in Connecticut in 1844.

Did you know?

Individuals are never “cured” of addictions. Instead, they learn how to manage their disease to lead healthy, balanced lives.

Did you know?

As of mid-2016, 18.2 million people were receiving advanced retroviral therapy (ART) worldwide. This represents between 43–50% of the 34–39.8 million people living with HIV.

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?

Long-term mental and physical effects from substance abuse include: paranoia, psychosis, immune deficiencies, and organ damage.

For a complete list of videos, visit our video library