首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

线程容易实例

2012-11-09 
线程简单实例线程简单实例public class Main extends Thread{public static void main(String[] args) {//

线程简单实例

线程简单实例

public class Main extends Thread{public static void main(String[] args) {//每隔3秒执行一次这个线程/*while (true) {try {Thread.sleep(3000);System.out.println("this is thread1");} catch (InterruptedException ex) {e.printStackTrace();}}*///3秒以后执行次线程try {Thread.sleep(3000);System.out.println("3秒后执行此线程");} catch (InterruptedException e) {e.printStackTrace();}}}

?

热点排行