Skip to content

Instantly share code, notes, and snippets.

@AnjaliManhas
Created July 30, 2020 17:26
Show Gist options
  • Save AnjaliManhas/bea4d2291d59586a29dc97423240e8d1 to your computer and use it in GitHub Desktop.
Save AnjaliManhas/bea4d2291d59586a29dc97423240e8d1 to your computer and use it in GitHub Desktop.
assigning a task to ExecutorService using submit() method
package com.wordpress.compilationerrors;
import java.lang.Runnable;
import java.lang.*;
import java.util.concurrent.*;
// assigning a task to ExecutorService using submit() method
public class ExecutorServiceExample {
public static void main(String[] args) {
ExecutorService executorService = Executors.newSingleThreadExecutor();
executorService.submit(new Runnable() {
@Override
public void run() {
System.out.println("ExecutorService");
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment