Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Task {
- public static enum TaskList {
- TASK_A {
- @Override
- void doProcess() {
- System.out.println("processing task A");
- }
- },
- TASK_B {
- @Override
- void doProcess() {
- System.out.println("processing task B");
- }
- },
- TASK_C {
- @Override
- void doProcess() {
- System.out.println("processing task C");
- }
- };
- abstract void doProcess();
- }
- }
- public static void main(String[] args) {
- Thread thread = new Thread(new Runnable() {
- @Override
- public void run() {
- //following code will be executed in multiple threads.
- Task.TaskList task = Task.TaskList.TASK_A;
- task.doProcess();
- }
- });
- thread.start();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement