String is a class and the output of Strings (even literals) are printed as one might expect via the toString override. Arrays are objects but are an inherent part of the language so their presentation is not overridden but internally inherited from the Object class. Section 10.8 of the JLS says.
Although an array type is not a class, the Class object of
every array acts as if:
• The direct superclass of every array type is Object.
• Every array type implements the interfaces Cloneable and
java.io.Serializable.
If you want to see the actual hashCode that results from computations involving "abc" then do the following. Both will give the same result.
String s = new String("abc"); // normally overkill
System.out.println("abc".hashCode());
System.out.println(s.hashCode());
if you want to see the hashCode
prior to being overridden (undefined but could be be the memory address of the object), then do the following:
System.out.println(System.identityHashCode("abc"));
System.out.println(System.identityHashCode(s));
For arrays you can also do this. These will be the same since arrays inherit their hashCode from Object without regard to content.
int[] a = {1};
System.out.println(a.hashCode());
System.out.println(System.identityHashCode(a));
a[0] = 12345;
System.out.println(a.hashCode());
System.out.println(System.identityHashCode(a));