每隔一秒钟显示一个字符串“Hello”

来源:互联网 发布:织梦cms模板安装教程 编辑:程序博客网 时间:2024/05/15 00:05
public class test implements Runnable{public static void main(String args[]){test t=new test();Thread tt = new Thread(t);tt.start();}public void run(){for(;;){try{Thread.sleep(1000);}catch(InterruptedException e){}System.out.println("Hello");}}}


0 0
原创粉丝点击