The output of the below code is false
String str = \"3456\";
String str1 = \"3456\";
System.out.println(Integer.valueOf(str).equals(str1));
Usually, when implementing equals(), one of the first things to do is to check whether the objects are of one and the same type.
public boolean equals(Object obj) {
if (!(obj instanceof SomeType)) return false;
...
}
This is also applied in the Integer and String classes, which answers the question why do you receive false as a result.