Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

StringBuffer & StringBuilder

 
Sanjay Izardar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are there some methods which are defined in StringBuffer but not in StringBuilder class?
 
Darryl Burke
Bartender
Posts: 5125
11
Java Netbeans IDE Opera
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does the API say?
 
Ikpefua Jacob-Obinyan
Ranch Hand
Posts: 394
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sanjay Izardar wrote:

are there some methods which are defined in StringBuffer but not in StringBuilder class?

Ikpefua wrote:

Hello Sanjay, the API says both classes are virtually the same, the ONLY difference is that
StringBuffer has sychronized methods to make it threads safe.

For the exams you need to know the differences between the StringBuffer/StringBuilder compared to the String class.

I hope this helps.
 
Mala Gupta
Author
Ranch Hand
Posts: 291
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apart from referring to the Java API, you can also refer to the source code of these classes - if you are keen on witnessing the differences yourself.

cheers
Mala
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic