Java8: Closures

Photo by Yves Alarie on Unsplash
int a=10;
int b=20;
operate(a, new Calculator() {
@Override
public void process(int i) {
System.out.println(i + " - " + b);
}
});
int a=10;
int b=20;
operate(a, new Calculator() {
b=2;
@Override
public void process(int i) {
System.out.println(i + " - " + b);
}
});

--

--

--

Sometimes A software Engineer, sometimes a support engineer, sometimes a devops engineer, sometimes a cloud engineer :D That’s how the this life goes!

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Capturing and Editing Packets with PyDivert

Source: http://www.cs.cmu.edu/afs/cs/academic/class/15441-f01/www/assignments/P2/htmlproj2_split/node5.html

Using “WITH” in SQL

Zero Knowledge Proof —Deep into libsnark

232. Implement Queue using Stacks

What is new in My Digital Garden Last Month — (in Nov 2021)

Above you can see an example design of an app we’re currently building at HYPE4. As you can see

Our Experience to a Virtual Hack of Health

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nuwan Zen

Nuwan Zen

Sometimes A software Engineer, sometimes a support engineer, sometimes a devops engineer, sometimes a cloud engineer :D That’s how the this life goes!

More from Medium

Immutability Matter in Java

Java8 Features Card

COLLECTIONS IN JAVA

Singleton Design Pattern (Java)