public class PingPong {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
Thread t = new Thread() {
@Override
public void run() {
pong();
}
};
t.start(); // not t.run();
// Thread.sleep(3000);
// t.join(); //wait it finish
System.out.print("Ping");
}
private static void pong() {
System.out.print("Pong");
}
}
PingPong or PongPing
最新推荐文章于 2022-11-11 20:11:45 发布