I know that String are immutable and once created they cannot change their values. If so, please guide me to understand what is "wrong" with my code as apparently I was able to change the value of the initial String. Thanks in advance
package ocajp;
public class TStatic1 {
static String s1 = "Ann";
static void change() { s1 += " has apples";}
public static void main(String[] args) {
change();
System.out.println("s1: " + s1);
}
}
s1: Ann has apples