What is the difference between character array and a String?
i. character array is mutable. that means we can change the content of a character array
ii. String objects are immutable.
iii. we can apply all string functions directly on character array.
i & ii
i, ii, & iii
There are 3 major differences between character array and strings.
1. character arrays are mutable, you can change its content, where strings are immutable.
2. we can't apply String class functions directly on character array, as array doesn't have these functions.
3. Due to immutable property you can easily share a string object with multiple threads where it is not possible for character arrays, as any thread can modify it without synchronizing properly.
Back To Top