What is meant by immutable?

This could be the dumbest question ever asked but I think it is quite confusing for a Java newbie.

  1. Can somebody clarify what is meant by immutable?
  2. Why is a String immutable?
  3. What are the advantages/disadvantages of the immutable objects?
  4. Why should a mutable object such as StringBuilder be preferred over String and vice-verse?

A nice example (in Java) will be really appreciated.

17 Answers
17

Leave a Comment