java compare two strings if they are equal

Solutions on MaxInterview for java compare two strings if they are equal by the best coders in the world

showing results for - "java compare two strings if they are equal"
Clara
27 Jan 2021
1String myStr1 = "Hello";
2String myStr2 = "Hello";
3String myStr3 = "Another String";
4System.out.println(myStr1.equals(myStr2)); // Returns true because they are equal
5System.out.println(myStr1.equals(myStr3)); // false