public static void main(
String[] args) {
String str1="Java";
str1="one";
System.out.println("str1="+str1);
}
As per book OCA
Java SE7 certification guide by Mala Gupta,
String object is stored in a private final char array in String.java.
private final char value[];
The basic characteristic of a final variable is that it can initialize a value only once. By
marking the variable value as final, the class String makes sure that it can’t be reassigned
a value.
so the String objects can be initialized only once but the above code shows that str1 was initialized first with "Java", then it can be re-assigned value "one" bcos the output is one. If it can be re-initialized, basic characteristic of final variable is not satisified and hence how can we call String objects are immutable?