As Wiki states
In object-oriented [...], an immutable object is an object whose state cannot be modified after it is created.
That totally applies to Java's Integer. Let's take a look at the code to talk about:
Integer a = 5;
Integer b = a;
b = b+1;
System.out.println("a = " + a); // a = 5
System.out.println("b = " + b); // b = 6
Integer is a class then why variables a and b have different values?! - you may ask. See the explanation if eager.
→ Continue reading