Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Difference Between String and String Buffer?

buffer String
0
Posted

Difference Between String and String Buffer?

0

Ans:- String is a Collection or array of Characters.when u create a string object u r creating a string that can’t be changed. this approach is used becoz fixed, immutable strings can be implemented more efficiently then the muttable (Changeable Ones ) strings. StringBuffer – StringBuffer Represents growable and writeable character sequences.StringBuffer may have characters and substrings inserted in the middle or append to end. StringBuffer allocates room for 16 additional Characters when no specific buffer length is requested, becoz reallocation is a costly process in terms of time. Que:-2 difference between verses (==) and .equals(). Ans. .equals() is used for comparing values of a string objects and verses ( ==) is used to compare there memory reference.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123