Simply put in the same value, but the same and different distinction, for example,
Public class test {public static void main (string [] args) {test a = new test (); system.out.println (a.isright ()); system.out.println (a.sswrong ());} Public boolean isright () {string str1 = "abc"; string str2 = "abc"; if (str1.equals (str2)) return true; returnlean iswrong ()} public boolean iswrong () {string str1 = new string ("ABC "); String str2 = new string (" abc "); if (str1.equals (str2)) return true; returnaf false;}}
Print Result true, True If you replace Equals to "==", the result is true, false