Multiple choice

What will be the value of “str” after executing the following statements? StringBuffer str=new StringBuffer(“I am a student”); str.delete(2,6);

  1. I student

  2. Istudent

  3. Itudent

  4. I am a student

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The method str.delete() deletes the characters in the string in the sequence 2 to 6. Hence, the output will be “I student”.