You have not tried it yourself because < , > , <= and >= do not work with objects.
However == compares the left and right operands. When they are binary, this leads to truth. In the case of objects, pointers are compared. Thus, this means that it will only lead to truth if the object remains left and right with the same object in memory.
Other methods, such as compareTo and equals, are created to provide a custom method for comparing with various objects in memory, but which can be equal to each other (i.e. the data is the same).
In the case of strings, for example:
String str0 = new String("foo"); String str1 = new String("foo"); // A human being would say that the two strings are equal, which is true // But it are TWO different objects in memory. So, using == will result // in false System.out.println(str0 == str1); // false // But if we want to check the content of the string, we can use the equals method, // because that method compares character by character of the two objects String.out.println(str0.equals(str1)); // true String.out.println(str1.equals(str0)); // true
source share