⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 threaddemo1.java

📁 为成会员而传的
💻 JAVA
字号:
/*
 * ThreadTest.java
 *
 * Created on 2008年3月22日, 下午6:56
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

/**
 *
 * @author Administrator
 */
class ThreadTest extends Thread {
    
    /** Creates a new instance of ThreadTest */
    public ThreadTest() {
    }
    public void run()
    {
        for(int i=1;i<=10;i++)
        {
            System.out.println(Thread.currentThread().getName()+"is running");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            }
            
        }
    }
}
public class ThreadDemo1
{
    
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       ThreadTest t=new ThreadTest();
       t.start();
       for(int i=1;i<=10;i++)
       {
           System.out.println("main thread is running");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            }
       }
    }
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -