Why would the StringBuffer
have a limit on its size?
I went through some of the links : http://www.coderanch.com/t/540346/java/java/maximum-size-hold-String-buffer.
Is that because of the count member variable, which is an int?
Suppose that we have 2^31-1 chars in StringBuffer
and that we append some more chars to that StringBuffer
. Count member variable would be incremented by the number of chars appended and if Count variable is already at its max (2^31-1), it would revert back to some negative value.
Why would it throw an error?