What is the maximum length of a String in Java? - Cracking the Java Coding Interview

preview_player
Показать описание
Cracking the #Java #Coding #Interview - Question 59: What is the maximum length of a String in Java?
Рекомендации по теме
Комментарии
Автор

Finally an answer to how long is a piece of string.

chaoslab
Автор

Honestly, I always thought that Java Strings (since Java 9) had 2 inner classes: one backed by a char[] and one for other encodings using a byte[].
Checked the source code and turns out I was wrong. Good to know. Thanks!

TheDarkOne
Автор

2^31 - 1, there may be other limitations such as the memory allocation 4GB ram

romanburczymorda