Search:

Type: Posts; User: KevinWorkman

Search: Search took 0.10 seconds.

  1. Replies
    9
    Views
    1,884

    [SOLVED] Re: Difference between == and equals.

    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 ==...
  2. Replies
    9
    Views
    1,884

    [SOLVED] Re: Difference between == and equals.

    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.
  3. Replies
    9
    Views
    1,884

    [SOLVED] Re: Difference between == and equals.

    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...
Results 1 to 3 of 3