Which two code fragments, inserted independently at line 3, generate the output 4247?

Given:
1. public class TestString3 {
2. public static void main(String[] args) {
3. // insert code here
5. System.out.println(s);
6. }
7. }

Which two code fragments, inserted independently at line 3, generate the output 4247? (Choose
two.)

Given:
1. public class TestString3 {
2. public static void main(String[] args) {
3. // insert code here
5. System.out.println(s);
6. }
7. }

Which two code fragments, inserted independently at line 3, generate the output 4247? (Choose
two.)

A.
StringBuilder s = new StringBuilder(“123456789”);

B.
delete(0,3).delete(1,3).delete(2,5).insert(1, “24”);

C.
StringBuffer s = new StringBuffer(“123456789”);

D.
delete(0,3).replace(1,3,”24″).delete(4,6);

E.
String s = “123456789”;
s = (s-“123″).replace(1,3,”24”) – “89”;

F.
StringBuffer s = new StringBuffer(“123456789”);

G.
substring(3,6).delete(1,3).insert(1, “24”);

H.
StringBuilder s = new StringBuilder(“123456789”);

I.
substring(3,6).delete(1,2).insert(1, “24”);



Leave a Reply 0

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