Question: Which statement replacing the comment will result in printing: B 2 ton ro B 2? String s1 = 2 B or not 2 B; String

Which statement replacing the comment will result in printing: B 2 ton ro B 2?

String s1 = "2 B or not 2 B";

String s2 = "";

for (int i = 0; i < s1.length(); i++) {

char ch = s1.charAt(i);

// replace with statement

}

System.out.println(s2);

s1 = ch + s1;
s1 = s1 + ch;
s2 = ch + s2;
s2 = s2 + ch;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!