Hi friends,
I hope successes to everybody!
My question is such:
1. class Mutate {
2. public static void main(
String [] args) {
3. StringBuilder s = new StringBuilder("012345678 ");
4. if (s.length() == 10)
5. s.insert(10, "abcdef");
6. s.delete(3,8);
7. System.out.println(s.indexOf("c"));
8. }
9. }
What is the result?
a. -1
b. 5
c. 6
d. 7
e. Compilation fails.
f. An exception is thrown at runtime.
one of my friend said me that the result must be "d. Compilation fails." .
but when i run this program the output shows 7
Can you please which one is true?
Sincerely,
Rizvan