`

PingPong or PongPing

    博客分类:
  • Java
阅读更多

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");
	}
}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics