View RSS Feed

Java String

Problem with String in Java

Rate this Entry
by , 04-26-2012 at 07:28 PM (469 Views)
In java string, biggest strength well known as immutability is actually the biggest problem encountered in case it is not used appropriately. String is created many times and lots of operations are being performed at them. For example, string conversion into lowercase, uppercase, concatenating with string or getting substring out. Though String is considered as immutable class, when a new string is created evertime and the old one gets discarded that makes temporary garbage a lot, in heap. If String literal is used to create the String and they are present in the String pool. For such problem resolution, two classes are provided by Java which are StringBuilder and StringBuffer. StringBuilder is new one & StringBuffer is older one, added in JDK 5.

Submit "Problem with String in Java" to Facebook Submit "Problem with String in Java" to Digg Submit "Problem with String in Java" to Submit "Problem with String in Java" to StumbleUpon Submit "Problem with String in Java" to Google