threadtest.java
来自「本程序用JAVA编制」· Java 代码 · 共 56 行
JAVA
56 行
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 + =
减小字号Ctrl + -
显示快捷键?