Hello! Tell me pliz what is the difference between the function of comparing strings equals and contains ???

  • 2
    I'm not familiar with java, but in my opinion, it is obvious from the title that contains should not compare strings - DreamChild
  • 2
    Have you tried javadoc? - a_gura

1 answer 1

"text text".equals("text") // false "text text".contains("text") // true 

Equals - whether the strings are the same.

Contains - whether one line contains another

  • four
    we can add that mathematically: equals (x, y) = x.contains (y) and y.contains (x) - KoVadim
  • five
    It is possible and not mathematical. Lines "Went" and "Went to $% #!" The second one contains (contains) the first, but not equivalent to it - alexlz