String performance

how to print address of a string

@akshay9009,
It is not possible. Java is a high level language and does not allow direct pointers.

Although internally, it allows pass by reference(not for primitive data types), i.e., passing of an object to a method is done by default, a pass by address. It means, if you pass an object to a method, not the object, but its address is received in the method.

System.identityHashCode(myString1) might be close enough, depending on what you are trying to achieve, but Memory addresses aren’t generally available through the Java language.