Interview Questions

Java Interview Question and Answer Part II

[adinserter block="4"]

1) Difference between String, StringBuffer and StringBuilder in Java?
String is immutable while both StringBuffer and StringBuilder is mutable, which means any change e.g. converting String to upper case or trimming white space will produce another instance rather than changing the same instance. On later two, StringBuffer is synchronized while StringBuilder is not, in fact its a ditto replacement of StringBuffer added in Java 1.5.

[adinserter block="2"]


Leave a Reply

Your email address will not be published. Required fields are marked *