Java / Interface
Explain the difference between lambda expression and anonymous class in terms of this reference.
With an inner class, it creates a new scope. You can overwrite local variables from the enclosing scope by instantiating new local variables with the same names. You can also use the keyword this inside your inner class as a reference to its instance.
However, lambda expressions work with enclosing scope. You cant overwrite variables from the enclosing scope inside the lambdas body. In this case, the keyword this is a reference to an enclosing instance.
More Related questions...