About 51 results
Open links in new tab
  1. How do I compare strings in Java? - Stack Overflow

    Apr 2, 2013 · The Java String class actually overrides the default equals() implementation in the Object class – and it overrides the method so that it checks only the values of the strings, not their locations …

  2. java - How the equals () method works - Stack Overflow

    Jul 12, 2021 · The equals method code that you have provided is not from String class but from the Object class, which is overridden be the String class implementation which checks if the contents of …

  3. How does .equals Java String Class method work?

    The equals() method is used to verify if the state of the instances of two Java classes is the same. Because equals() is from the Object class, every Java class inherits it. But the equals() method has …

  4. java - String.equals versus == - Stack Overflow

    Let's see it happen in Java terms. Here's the source code of String's equals() method: It compares the Strings character by character, in order to come to a conclusion that they are indeed equal. That's …

  5. Using the equals () method with String and Object in Java

    Sep 8, 2014 · For comparing strings, a string class will override the equals() Method and compare strings in it. Object.equals() will compare only references, where String.equals() will compare values.

  6. how does default equals implementation in java works for String?

    Mar 23, 2013 · String class in java overrides the equals method of Object class such that it compares the content of the two strings rather than comparing the references (default implementation of in …

  7. What is the difference between == and equals () in Java?

    The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and …

  8. How to override equals method in Java - Stack Overflow

    I am trying to override equals method in Java. I have a class People which basically has 2 data fields name and age. Now I want to override equals method so that I can check between 2 People object...

  9. What's the difference between ".equals" and - Stack Overflow

    Java String class actually overrides the default equals () implementation in the Object class – and it overrides the method so that it checks only the values of the strings, not their locations in memory.

  10. java - Comparing StringBuffer content with equals - Stack Overflow

    In fact, String, StringBuffer, StringBuilder and CharBuffer all implement the CharSequence interface, and the javadoc for this interface says this: This interface does not refine the general contracts of the …