Question: Which is the most reliable expression for testing whether the values of two string variables are the same?

  1. string1 == string2
  2. string1 = string2
  3. string1.matches(string2)
  4. string1.equals(string2)

Answer: The correct answer of the above question is Option D:string1.equals(string2)