Professional Documents
Culture Documents
Activites Stringbuilder
Activites Stringbuilder
Activites Stringbuilder
Student’s Name:
3.For each of the following, show what is printed. For each part, start from the following declaration
and initial values:
(b) str1.delete(0,11);
str1.insert(0,"office");
System.out.println(str1); (b): office refrigerator
(c) str2.delete(5,9);
str3 = str2.substring(10,15); //careful
str2.insert(5,str3);
str2.delete(15,20);
str2.insert(15,"vision");
System.out.println(str2); (c): microphone television
(d) str1.delete(14);
str1.insert(14,"treat");
System.out.println(str1); (d): living room retreat
4 In the following program, called ComputeResult, what is the value of result after each numbered line
executes?
System.out.println(result);
}
}
Your answer:
1) bi
2) by
3) bey
4) beyelt
5) beyi elt