callableexample.java
来自「一步 教你学会java 完成一个完整的SWT系统 是本人学习java」· Java 代码 · 共 36 行
JAVA
36 行
/** * 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 + =
减小字号Ctrl + -
显示快捷键?