Question: Which is the most reliable expression for testing whether the values of two string variables are the same?
- string1 == string2
- string1 = string2
- string1.matches(string2)
- string1.equals(string2)
Answer: The correct answer of the above question is Option D:string1.equals(string2)