Seems like you got it. To really drive the point home, try doing something like this:
String x = new String("Goldest");
String y = new String("Goldest");
System.out.println("x == y : " + (x ==...
Type: Posts; User: KevinWorkman
Seems like you got it. To really drive the point home, try doing something like this:
String x = new String("Goldest");
String y = new String("Goldest");
System.out.println("x == y : " + (x ==...
That depends on your requirements. Use == when you want to compare instances. Use the equals() method when you want to compare the semantics of those instances.
What do you mean by "where are those references"? Where in terms of what?
Like you said, when dealing with Objects, == compares the instances, not the content. Calling toString() twice apparently...