clone()
and finalize()
methods with the protected
access modifier in java.lang.Object
.
In an interface, it is possible to declare these methods with a return type that is incompatible with java.lang.Object
methods.
This allows creating a class that implements such an interface.
When the interface is functional, it is possible to create a lambda from it, but the code might still be confusing.
Example:
// Warning: this interface cannot be implemented
// by any class,only by a lambda or method reference
interface MyInterface {
double clone();
}
New in 2016.1