What is the use of inheriting object class methods in functional interface eg- toString, equals
问题 I found following code, What is use of inherited equals() and toString() method. @FunctionalInterface public interface FunInterface<T> { // An abstract method declared in the functional interface int test(T o1, T o2); // Re-declaration of the equals() method in the Object class boolean equals(Object obj); String toString(); } 回答1: The main reason to (re)declare such a method, is to extend and document the contract. In case of Comparator.equals(…), it’s not that obvious, as it doesn’t specify