📄 threadtest.java
字号:
import java.util.*;import java.sql.Timestamp;class thread1 extends Thread{ Date now = new Date(); Timestamp time = new Timestamp(now.getTime()); public thread1(String stock1){ super(stock1); } public void run(){ for(int i=0;;i++){ System.out.println(i+" "+getName()); //MergeStock stock=new MergeStock(); //WeatherExtractor weather = new WeatherExtractor(); try{ sleep(60000); } catch(InterruptedException e){ } } } } /*class thread2 extends Thread{ Date now = new Date(); Timestamp time = new Timestamp(now.getTime()); public thread2(String all){ super(all); } public void run(){ for(int i=0;;i++){ System.out.println(i+" "+getName()); //MergeStock stock=new MergeStock(); //WeatherExtractor weather = new WeatherExtractor(); try{ sleep(60000); } catch(InterruptedException e){ } } } }*/public class ThreadTest { public static void main(String[] args) { thread1 t=new thread1("qlsh"); t.start(); if (t.isInterrupted()){ t.start(); } //new thread2("all").start(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -