Java中的线程的休眠Thread.sleep()

Posted asdfasdfasdad

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java中的线程的休眠Thread.sleep()相关的知识,希望对你有一定的参考价值。

class MyThead implements Runnable

	public void run()
	
		System.out.println("我休息了!");
		try
		
			Thread.sleep(1000);
		
		catch (InterruptedException e)
		
		
		System.out.println("一秒后在叫我吧!");
	


public class TheadMain

	public static void main(String[] args)
	
		MyThead myThead = new MyThead();
		Thread thread = new Thread(myThead);
		thread.start();
	

以上是关于Java中的线程的休眠Thread.sleep()的主要内容,如果未能解决你的问题,请参考以下文章