In the following Java code, which code fragment should be inserted at line 3 so that the output will be: "123abc 123abc"?
1. StringBuilder sb1 = new StringBuilder("123");2. String s1 = "123";3. // insert code here4. System.out.println(sb1 + " " + s1);
1. StringBuilder sb1 = new StringBuilder("123");2. String s1 = "123";3. // insert code here4. System.out.println(sb1 + " " + s1);In the following Java code, which code fragment should be inserted at line 3 so that the output will be: "123abc 123abc"?
1. StringBuilder sb1 = new StringBuilder("123");2. String s1 = "123";3. // insert code here4. System.out.println(sb1 + " " + s1); Correct Answer sb1.append("abc"); s1 = s1.concat("abc");
মোঃ আরিফুল ইসলাম
Feb 20, 2025