Can you please explain the difference between string string buffer and string builder

+1 vote
Hey,

The problem is every time I got confused with these three concepts . Can you please give me the proper idea about these three?

Thank you,
Jun 3, 2019 in Java by Sujoy
456 views

1 answer to this question.

+1 vote
String are immutable where as StringBuffer and StringBuilder are mutable.

StringBuffer is thread safe and syncronized whereas StringBuilder is not, thats why StringBuilder is faster as compared to StringBuffer.

String overrides equals() and hashCode() methods as the base class of String is Object.

For String manipulations in non-multi threaded environment, we should use StringBuilder else use StringBuffer class.
answered Jul 5, 2019 by Akash
• 160 points

Related Questions In Java

0 votes
2 answers

Please explain me the difference between scanner and the buffer reader?

As per your question for reading a ...READ MORE

answered Aug 27, 2019 in Java by Sirajul
• 59,170 points
1,792 views
0 votes
1 answer

Can you explain what is the difference between hashtable and hashmap?

Hi, Hashtable is synchronized, whereas HashMap is not. This makes HashMap better for ...READ MORE

answered Aug 15, 2019 in Java by anonymous
250 views
+1 vote
4 answers

What is the difference between string object and string literal?

A String literal is a Java language concept. This ...READ MORE

answered Aug 16, 2019 in Java by Sirajul
• 59,170 points
44,925 views
+2 votes
2 answers

Can you give me the proper difference between java.util.Date vs java.sql.Date ?

As per Javadoc java.sql.Date is a thin wrapper around millisecond ...READ MORE

answered Aug 2, 2019 in Java by sampriti
• 1,120 points
9,329 views
0 votes
1 answer

What is the difference between main(String[] args) and main(String... args) in Java?

String[] is used to accept a single parameter ...READ MORE

answered Sep 6, 2019 in Java by Piya
2,359 views
0 votes
2 answers

What is the difference between implements and extends?

Extends : This is used to get attributes ...READ MORE

answered Aug 3, 2018 in Java by samarth295
• 2,220 points
8,526 views
+1 vote
1 answer

Are arrays equivalent to objects in Java ?

Yes; the Java Language Specification writes: In the Java ...READ MORE

answered May 10, 2018 in Java by Rishabh
• 3,620 points
485 views
+1 vote
1 answer

Remove objects from an array in Java?

We can use external libraries: org.apache.commons.lang.ArrayUtils.remove(java.lang.Object[] array, int ...READ MORE

answered Jun 26, 2018 in Java by scarlett
• 1,290 points
487 views
+1 vote
1 answer

Performance difference of if/else vs switch statement in Java

The thing you are worried about is ...READ MORE

answered Jul 26, 2018 in Java by geek.erkami
• 2,680 points
2,188 views
+1 vote
3 answers

What is the syntax to declare and initialize an array in java?

You can use this method: String[] strs = ...READ MORE

answered Jul 25, 2018 in Java by samarth295
• 2,220 points
2,395 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP