The following Java code segment is from an AP Computer Science practice exam.
String s1 = \"ab\";
String s2 = s1;
s1 = s1 + \"c\";
System.out.println(s1 + \"
java.lang.String is an object, not a primitive.
What the code did in the first example is:
But to answer your question about reference or value, it's by reference.