A lambda expression is enclosed in class C's method foo:
class C {
// field x initialized
int x = 100;
// method foo
void foo(int x) {
/* lambda assigned to
functional interface */
Runnable r = () -> {
System.out.println(x);
};
// invoke lambda
r.run();
}
}
Instantiate C and call foo in main():
// in main
C c = new C();
c.foo(200);
What will printed by c.foo(200) as x?