This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, the boundary is 2^31-1 characters, since the getLength()-method of String returns an int-value. The other boundary is your RAM. So your String is limited by the boundary that is reached first. cu Stefan
There is one other limitation, though it would only come up rarely in practice: current Sun compilers don't like literal strings (like String s = "foo") over 65535 characters long. This was discussed somewhere on JavaRanch a month or two back, I remember writing a quick program to confirm it. In practical terms, RAM limitations crop up before int overflow errors. With repeated doubling of String length, think I crashed my JVM at length of around 2^23. Cheers, --Tim [ May 04, 2004: Message edited by: Tim West ]