Difference between string, string builder, and string buffer?



Difference between string, string builder, and string buffer?..

Answer / Babita Baghel

String is an immutable class in Java, meaning once created, it cannot be changed. StringBuffer and StringBuilder are mutable classes that can be modified after creation. StringBuilder is optimized for use with modern JVMs and should generally be preferred over StringBuffer due to slightly better performance.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

How can we create objects if we make the constructor private ?

1 Answers  


how and when compiler knows that the Java code throws the checked Exception.

2 Answers   HSBC,


Which is the class in java?

1 Answers  


Why is java so important?

1 Answers  


What makes a function well defined?

1 Answers  


What is the difference between call by reference and call by pointer?

1 Answers  


What is comparable and comparator interface? List their differences

1 Answers  


WHAT IS JDK,JVM,CLASS DEFINE ALL?

2 Answers  


What are the types of methodology?

1 Answers  


Define reflection.

1 Answers  


Why super is first line in java?

1 Answers  


What is singleton service?

1 Answers  


Categories