threaddemo3.java

来自「java netbeans 学习程序合集」· Java 代码 · 共 35 行

JAVA
35 行
字号
/*
 * ThreadDemo3.java
 *
 * Created on 2007年11月13日, 下午8:44
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.Adam;

/**
 *
 * @author Administrator
 */
public class ThreadDemo3 {
    
    /** Creates a new instance of ThreadDemo3 */
    public static void main(String[] args) {
        TestThread tt=new TestThread();
        Thread t=new Thread(tt);
        t.start();
        {
            System.out.println("main thread is running ");
        }
    }
    
}
class TestThread implements Runnable{
    public void run(){
        while(true){
              System.out.println(Thread.currentThread().getName()+" is running");
        }
    }
}

⌨️ 快捷键说明

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