What is the Maximum Size Of a String in Java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

What is the Maximum Size Of a String in Java?

What is the Maximum Size Of a String in Java?

26th Jan 2018, 3:03 AM
Corey
Corey - avatar
1 Answer
+ 1
It's an Object, not a primitive data type (char, byte, short, int, long, float, double) so it will have no limit besides the amount of RAM in your computer (even if that runs out, it will start using your drive as virtual RAM). It would take many millions of years to type a string that long. Probably months/years to generate it with a script. So, no limit.
26th Jan 2018, 3:42 AM
Isaac Pace
Isaac Pace - avatar