Created
August 20, 2025 12:51
-
-
Save Audhil/62c2bb845402b72d6e0cb8bdf94b3cd7 to your computer and use it in GitHub Desktop.
All about Executors!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.Executor; | |
public class ExecutorsSample { | |
public static void main(String[] args) { | |
// Executor executor = new Executor() { | |
// @Override | |
// public void execute(Runnable command) { | |
// command.run(); | |
// } | |
// }; | |
// we can simply write as follows | |
Executor executor = Runnable::run; | |
// placing runnable in executor | |
executor.execute(new Runnable() { | |
@Override | |
public void run() { | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment