📄 server.java
字号:
// The Server class provides a start m
import java.io.*;
import java.util.*;
public class Server
{
// null constructor
public Server() {
}
public void showMessage(String s)
{
PrintThread aThread;
aThread = new PrintThread (s);
aThread.start();
}
} // end class Ex_18
class PrintThread extends Thread{
final int SLEEP_TIME = 1000;
String theString;
// thread constructor
public PrintThread (String s )
{
super();
theString = s;
}
public void run() // thread execution
{
for (int i=0; i<10; i++)
System.out.println(theString);
try {
Thread.sleep( SLEEP_TIME );
}
catch ( InterruptedException exception ) {
System.err.println( exception.toString() );
}
}
} // end class PrintThread
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -