ensureCapacity() StringBuffer Example

ensureCapacity() StringBuffer method gives guarantee the existing capacity. It behaves in two ways depending on the argument passed to the method. If the argument of the method is less than the existing capacity, then there will be no change in existing capacity (observe, sb1 in the example). If the argument is greater than the existing …

ensureCapacity() StringBuffer Example Read More »