described above. for example.
String s = "abc";
System.out.println(s); // this method will output the string, not the address
so how to view the address, thanks in advance.
described above. for example.
String s = "abc";
System.out.println(s); // this method will output the string, not the address
so how to view the address, thanks in advance.
Java has no concept of "address", so it is impossible to get the address of any object, including strings.
if u want an answer as u mentioned in the comment, Actually there is a way to do it that way.
String s = new String("abc");
System.out.println(Integer.toHexString(s.hashCode()));
this will return
1ae66
This answer was historically accepted as correct and will only work for classes that didn't override the hashCode() method