To exploring lambda and its working, i write below code.
public class Foo { // enclose class
public static void main(String[] args) {
System.out.println(new Foo().new InnerFoo());
IntSupplier intSupplier = () -> 42;
System.out.println(intSupplier);
}
class InnerFoo{} // inner class
}
After execution of code, i come across below output.
Foo$InnerFoo@3af49f1c
Foo$$Lambda$15/0x0000000840064c40@13221655
i have basically 2 question based on output.
- To best of my knowledge, when every inner class is instantiated, it can be represent as EnclosingClass$InnerClass@hashcode as toString()(in case we do not override toString()). so does that mean, my Foo$$Lambda$15/0x0000000840064c40@13221655 is a definition of inner class ? if is to so, than how long that inner class loaded remains in JVM ?
- What is an implication of $$Lambda. How JVM will interpret it ?