is a lambda expression can only be used with a class that contains a single method in java code example
Example: how to use lambda in java
StateOwner stateOwner = new StateOwner();
stateOwner.addStateListener(
(oldState, newState) -> System.out.println("State changed")
);