Java Programming
primer-original-v2mediumJava Programming4. Arrays And Stringsprimer-original-v2

What will s2 contain after following lines of code? String s1 = one; String s2 = s1.concat(two);

Answer options

A
one
B
onetwo
C
twoone
D
two The string "two" referred by s2 is "concatenated to" the string "one" referred by s1.

Correct answer: one

Explanation

Quick AnswerThe correct answer is one because it directly addresses the core logic of Java Programming.

This question has been retained as-is due to its unique context.

Related Java Programming questions

Practice more Java Programming questions

PrimerPrep has independently reviewed practice questions and coding exercises — all free.