Back to Top

Friday, 27 January 2012

JAVA: What are the differences between the String and StringBuffer classes?

String class :
  1. Once an object is created and initialized, it can't be changed because it is Immutable.
  2. String object can be created Implicitly and Explicitly.

StringBuffer class :
  1.  StringBuffer class is mutable(can be modified), length and content can be changed through certain method calls. 
  2. It creates object Explicitly.

2 Responses to “ JAVA: What are the differences between the String and StringBuffer classes? ”

nofearinc said...
22 July 2012 at 17:00

and also better use StringBuilder for non-synchronization calls for a better performance of building char arrays than the StringBuffer approach (available since J 5.0)


Naviya Nair said...
24 October 2016 at 15:26

I have read your blog its very attractive and impressive. I like it your blog.

Java Training in Chennai Java Training in Chennai | Core Java Training in Chennai

Online Java Training Java 8 Online Training | Java J2EE Online Training | JavaEE Training Institute in Chennai Java Training Institutes

Java Training Institutes in Chennai Java Training in Chennai


Post a Comment

Popular Posts

Subscribe via Email
Subscribe Java Interview Questions via Email
All Rights Reserved JAVA INTERVIEW QUESTIONS | Privacy Policy | Anijit Sarkar
blog links Web Directory Academics Blogs