Multiple choice

Ensurecapacity() method in Java is used

  1. to pre allocate space for a certain number of characters after a string buffer is constructed

  2. to determine whether a given string begins with a specified string

  3. to find the total allocated capacity of the stringbuffer

  4. to find the correct length of the stringbuffer

  5. to set the length of the stringbuffer

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

This is the characteristic of the method ensurecapacity().