You should read some Mutable and Immutable objects .
Example of immutable classes: String, Integer, Long Example of mutable classes: StringBuffer, Date
In mutable objects, you can change the state after it is built, for example
final StringBuffer a=new StringBuffer("Hello"); a.append("Welcome");
In an unchanged state, you cannot change the state of an object after it is built.
source share