| Author |
Max length for a String?
|
Balamaci Serban
Ranch Hand
Joined: Mar 16, 2005
Posts: 49
|
|
Does anyone know if Java has a maximum length of characters in a String? Thanks,!
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
|
The length() method returns a signed integer, so that the largest length() value is 2GB. Internally, all the implementations of String I've looked at use an int to keep track of the number of characters, meaning that 2GB is a hard limit. Given that many Java implementations have a heap-size limit somewhat less that 2GB, this is not really a problem!
|
[Jess in Action][AskingGoodQuestions]
|
 |
Balamaci Serban
Ranch Hand
Joined: Mar 16, 2005
Posts: 49
|
|
Whew that takes a stone off my chest. Thanks pardner!
|
 |
 |
|
|
subject: Max length for a String?
|
|
|