Skip to main content

Posts

Showing posts from August 28, 2017

String vs StringBuffer vs StringBuilder

What is the difference between String, StringBuffer and StringBuilder? String: Java String object is an immutable i.e. unmodifiable. It can be created by two ways by literal and new keyword. StringBuffer: Java StringBuffer is mutable. It can be created by using the new keyword. It is a synchronized means thread-safe. StringBuilder: Java StringBuilder is mutable. It is non-synchronized means not thread-safe.