Skip to content

Instantly share code, notes, and snippets.

@mahata
Created December 30, 2018 14:46
Show Gist options
  • Select an option

  • Save mahata/48cf8f205019ed59f4c39f7c1d572a23 to your computer and use it in GitHub Desktop.

Select an option

Save mahata/48cf8f205019ed59f4c39f7c1d572a23 to your computer and use it in GitHub Desktop.
StringBuffer takes 16 bytes as buffer
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
StringBuilder sb = new StringBuilder("abcde");
System.out.println(sb.capacity()); // 21: StringBuilder takes 16 bytes as buffer by default
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment