simplethread.java
来自「java 完全探索的随书源码」· Java 代码 · 共 26 行
JAVA
26 行
public class SimpleThread extends Thread{ // Default Constructor public SimpleThread( String name ) { super(); } // Override the parents run method to get the work done public void run() { // Do the thread work here System.out.println( getName() + " entered run method" ); try { System.out.println( getName() + " going to sleep..." ); // Tell this thread to go to sleep for 3000 millseconds sleep( 3000 ); } catch( InterruptedException ex ) { // Do nothing for now when this exception is raised } System.out.println( getName() + " woke up from sleep" ); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?