📄 callableexample.java
字号:
/** * Example code for JavaOne hands-on J2SE lab * * Concurrency utilities (JSR-166) example **/package future;import java.net.*;import java.io.*;import java.util.concurrent.*;/** * A simple implementation of the Callable interface that can return a value * to the thread that started it **/public class CallableExample implements Callable<String> { /** * The entry point called when this object is invoked as a new thread * of execution * * @returns A String as a simple result **/ public String call() { System.out.println("Starting call() method in second thread"); try { Thread.sleep(500); } catch (InterruptedException ie) { // Ignore } System.out.println("Completed call() method in second thread"); return "Finished"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -