This file contains 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
ldn-mbp-rpijnenburg:test rpijnenburg$ javac Service.java | |
Service.java:11: error: <identifier> expected | |
executorService.execute(new Runnable() { | |
^ | |
Service.java:11: error: illegal start of type | |
executorService.execute(new Runnable() { | |
^ | |
Service.java:11: error: ')' expected | |
executorService.execute(new Runnable() { | |
^ | |
Service.java:11: error: ';' expected | |
executorService.execute(new Runnable() { | |
^ | |
Service.java:11: error: illegal start of type | |
executorService.execute(new Runnable() { | |
^ | |
Service.java:11: error: <identifier> expected | |
executorService.execute(new Runnable() { | |
^ | |
Service.java:11: error: ';' expected | |
executorService.execute(new Runnable() { | |
^ | |
Service.java:15: error: class, interface, or enum expected | |
}); | |
^ | |
Service.java:17: error: class, interface, or enum expected | |
executorService.shutdown(); | |
^ | |
Service.java:18: error: class, interface, or enum expected | |
} | |
^ | |
10 errors |
This file contains 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.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.Future; | |
import java.lang.Runnable; | |
public class Service { | |
ExecutorService executorService = Executors.newSingleThreadExecutor(); | |
executorService.execute(new Runnable() { | |
public void run() { | |
System.out.println("Asynchronous task"); | |
} | |
}); | |
executorService.shutdown(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment