How to confirm( or get the object repesentation of string) if string created in pool or not?
- 阅读更多 关于 How to confirm( or get the object repesentation of string) if string created in pool or not?
问题 I want to confirm if two String variable created is pointing to the same memory.The way I did it with normal class Ideone a=new Ideone(); Ideone b=a; System.out.println(a+" "+b); Output Ideone@106d69c Ideone@106d69c The output produced here is not the exact memory address but it gave hex code which are same and by which I can say that they both are pointing to same memory address or values. But in case of String String a="helloworld"; String b="hello"; String c=b+"world"; System.out.println(a