0
Any explanation for why not share the same reference at string pool?
7 Antworten
+ 5
The correct "operator" to compare the VALUES of two strings is the equals-method. You're comparing two different objects, which just contain two equal string values. This doesn't make them to the SAME objects.
+ 1
@sandra I know "equals" and when to use
but I can't understand why c and d do not refer to the same object as I thought that d is at string pool because there is no "new String()" but is that mean c is not allocated at the string pool by concatenation
0
@Coder that's a good tip 💡
thanks a lot