Closures are also called lexical closures
Closures are first defined as an entity that contains < environment components > and < control Components > .
Explanation: A closure is a function that references a free variable, and the referenced variable will exist with the function.
EXPLANATION Two: Closures are entities that comprise functions and related reference environments.
Note:< free variable >: Other variables except local variables
Simple to understand: a closure can store a method as a variable that has the ability to access the free variables of the class in which it is located.
Java closure mechanism, its implementation requires two partial closure class (temporary salutation) + interface. Closure class: It is an object that can be called. It contains the contents of some scopes (which can be arguments, methods), and it automatically has a reference to an external class that accesses the private members of the external class.
The closure mechanism can solve the problem of doing different operations with the same method.
Callback: In short, A is called B to do one thing and tell him to inform after the completion of the notice, specifically how to inform a decision, the operation or method of this notice is the callback method
Java Closures and callbacks