In Java, these are the difference between String, String Builder and String Buffer:
| String |
String Buffer |
String Builder |
| Immutable (cannot be changed after creation) |
Mutable (can be changed after creation) |
Mutable (can be changed after creation) |
| Thread Safe (Can be used across threads) |
Thread Safe (Can be used across threads) |
Not thread safe |
| Performance is good |
Performance is slow due to synchronized overhead |
Performance is good |
| '+' operation can be used in String to add two strings |
'+' operation is not allowed |
'+' operation is not allowed |
| Stored in constant String pool |
Stored in Heap area of memory |
Stored in Heap area of memory |
Great work done by the blogger to define the above 3 terms and explain the difference between them as they are used in Java programming and essential part of its coding. I like and praise its effort very much.
ReplyDelete