This could be the dumbest question ever asked but I think it is quite confusing for a Java newbie.
- Can somebody clarify what is meant by immutable?
- Why is a
String
immutable? - What are the advantages/disadvantages of the immutable objects?
- Why should a mutable object such as
StringBuilder
be preferred over String and vice-verse?
A nice example (in Java) will be really appreciated.