Browsed by
Tag: string

String vs StringBuffer vs StringBuilder

String vs StringBuffer vs StringBuilder

Java provides different built-in classes around String such as String, StringBuilder, StringBuffer and many more. String object is widely used by programmers, which has certain features which restrict it’s usage, such as Immutable and thread safe. The thread safe is good is in case of multi-threading environment but immutable feature is a bottle neck in a situation where manipulation of string is required as it’ll lead to successive creation of different string object whenever given string object is manupulated. This lead to creation of StringBuffer and StringBuilder in which immutability has been removed. Here in this post we’ll see comparison of String vs Stringbuffer vs Stringbuilder.

Below listed are some common features and differences between String, StringBuffer and StringBuilder.

Read More Read More

Stringbuilder in Java

Stringbuilder in Java

StringBuilder is mutable sequence of characters which is used to create mutable string i.e. they can be modified or say their state can be changed unlike in case of immutable objects as string.

While performing various operation with String, the only thing bother is immutability of strings. This led to introduction of Stringbuilder and Stringbuffer. Here in blog we’ll be discussing about Stringbuilder.

Read More Read More