停止代码2秒钟并恢复 [英] stopping a code for 2 seconds and resume

查看:59
本文介绍了停止代码2秒钟并恢复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

我的问题很简单。如何让我的代码在执行时停止2或3秒然后恢复执行。


提前感谢

hsn

hello everyone.
my question is simple. how can i make my code while it is executing to stop for 2 or 3 seconds and then resume executing.

thanks in advance
hsn

推荐答案

Thread.sleep。


Thread.sleep。



有没有其他方式而不是使用线程?

is there any other way rather than using threads??



有没有其他方式而不是使用线程?
is there any other way rather than using threads??



你永远不会逃避线程。总是至少有一个线程在执行。使用Thread.sleep有什么问题?它也很容易使用......

You can never run away from threads. There is always at least one thread executing anyway. What''s wrong with using Thread.sleep? It''s very easy to use too ...


这篇关于停止代码2秒钟并恢复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆