setLength() StringBuffer Example

setLength() StringBuffer method sets the number of characters that can exist in the buffer. Must be careful in the usage: if the setLengtgh() is set with less size of number of characters, the extra characters in the buffer will be truncated off. What Java API says ablout setLength() StringBuffer: public synchronized void setLength(int newLength): sets …

setLength() StringBuffer Example Read More »