Multiple choice

What is the correct syntax of replace() method of the StringBuffer class?

  1. StringBuffer replace(int s,int e)

  2. StringBuffer replace(int s,String str)

  3. StringBuffer replace(int s,String str1,String str2)

  4. StringBuffer replace(int s,int e,String str)

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

The correct syntax of the replace() method is StringBuffer replace(int s,int e,String str) Replaces the characters in a substring of the given sequence with the given string 'str'.