Created
December 30, 2018 14:46
-
-
Save mahata/48cf8f205019ed59f4c39f7c1d572a23 to your computer and use it in GitHub Desktop.
StringBuffer takes 16 bytes as buffer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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