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 32 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
YES! Correct, THANKS for helping me on my review


rleezy04

  • Member
  • Posts: 322
Reply 3 on: Yesterday
Thanks for the timely response, appreciate it

 

Did you know?

According to the Migraine Research Foundation, migraines are the third most prevalent illness in the world. Women are most affected (18%), followed by children of both sexes (10%), and men (6%).

Did you know?

Studies show that systolic blood pressure can be significantly lowered by taking statins. In fact, the higher the patient's baseline blood pressure, the greater the effect of statins on his or her blood pressure.

Did you know?

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

Did you know?

The types of cancer that alpha interferons are used to treat include hairy cell leukemia, melanoma, follicular non-Hodgkin's lymphoma, and AIDS-related Kaposi's sarcoma.

Did you know?

The most destructive flu epidemic of all times in recorded history occurred in 1918, with approximately 20 million deaths worldwide.

For a complete list of videos, visit our video library