Difference between String & StringBuffer
Answer Posted / srikanth reddy
-->String objects are constants and immutable where as
StringBuffer objects are mutable
-----------------------------------------
-->in string class we can create object by two ways
1)using new operator --> string s = new String("Java");
2)without new operator --> String s2="raju";
------------------------------------------
-->in string class there string constant pooling technique
but in stringbuffer there is no facility
-------------------------------------------
all the methods in stringbuufer class is synchorined so
thread safe but not in string class
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
FOR EXAMPLE WE R HAVING TWO LIST ELEMENTS ..BOTH LISTS CONTAINS ID,NAME,PLACE ..I NEED TO COMPARE BOTH IDS IN TWO LISTS,IF ID'S R SAME MEANS WE HAVE ADD THE DETAILS(LIKE NAME,PLACE) TO MAP...HOW IS POSSIBLE ?CAN ANY ONE SUGGEST?
What is the finalize method do?
What is runtime polymorphism or dynamic method dispatch?
What is math floor in java?
What is string substring?
Is 0 true or false?
Difference between process and thread?
What is an object class?
Is it possible to use Semaphore/ Mutex in an Interrupt Handler?
What is Java Shutdown Hook?
Why are pointers not secure?
How to create com object in Java?
What is a boolean used for?
What do you mean by collectors in java 8?
Explain wrapper classes in java?