Solved

How Many String Objects Are Instantiated by the Following Code

Question 21

Multiple Choice

How many String objects are instantiated by the following code segment (not including the literals) ?
String s1, output;
S1 = "hello";
Output = "\nThe string reversed is: " ;
For (int i = s1.length() - 1; i >= 0; i--)
Output += s1.charAt(i) + " " ;


A) 1.
B) 4.
C) 5.
D) 7.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions