Not exactly. From the API of the hashcode() method for String:
You can also used the hashcode() method to check it. each object has space in memory and can access it through memory address(I think that is
where the variable pointing).
print the hashcode() of your variable every before and after altering its value. you will notice that the hashcode() of the variable changes every alteration since that variable points to different memory address every alteration (because of being immutable of String)
you can also do some experiment in StringBuilder in java, StringBuilder is mutable unlike String. print hashcode() of your variable of StringBuilder every
before and after alteration, you'll see the difference between two.
In other words, the hashcode for this class doesn't directly refer to memory - doing so would be pretty catastrophic in terms of data structures that rely on the hashcode of an object (such as Maps or Sets). That being said, see the API for Object, whose hashcode implementation may be an integer representation of memory - however classes may often override this default implementation.
The hash code for a String object is computed as
s*31^(n-1) + s*31^(n-2) + ... + s[n-1]
using int arithmetic, where s[i] is the ith character of the string, n is the length of the string, and ^ indicates exponentiation. (The hash value of the empty string is zero.)