Which code fragment, when inserted at line 9, enables the code to print true?

Given the code fragment: Which code fragment, when inserted at line 9, enables the code
to print true?

Given the code fragment: Which code fragment, when inserted at line 9, enables the code
to print true?

A.
String str2 = str1;

B.
String str2 = new String (str1);

C.
String str2 = sb1. toString ();

D.
String str2 = “Duke”;



Leave a Reply 6

Your email address will not be published. Required fields are marked *


IO

IO

A.
String str2 = str1;

TC

TC

A is the right answer

Kaykay

Kaykay

Definitely A.

Tomas

Tomas

Answer A
String str2 = str1; // true
String str2 = new String(str1); // false
String str2 = sb1.toString(); // false
String str2 = “Duke”; // false

Google

Google

We came across a cool internet site which you may possibly love. Take a appear for those who want.