For this code NetBeans has a hint stating
This anonymous inner class creation can be turned into a lambda expression.
in the line with new Dog(). Replacing the code using the hint results in
which is invalid code
incompatible types: Dog is not a functional interface
no abstract method found in interface Dog
(Real world example: http://jdbi.org/apidocs/org/jdbi/v3/core/statement/SqlLogger.html This style of interfaces would also be a nice alternative to Swing’s *Listener/*Adapter pairs.)