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

📄 testthreadmethod.java

📁 《Java程序设计与应用》-张仕斌-源程序 《Java程序设计与应用》-张仕斌-源程序
💻 JAVA
字号:
/*
 * TestThreadMethod.java
 *
 * Created on 2006年10月19日, 下午12:10
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package example9_7;

/**
 *
 * @author Administrator
 */
public class TestThreadMethod extends Thread{
    
    /** Creates a new instance of TestThreadMethod */
    public TestThreadMethod() {
    }
public static int shareVar = 0;
	public TestThreadMethod(String name){super(name);}
	public synchronized void run(){
		for(int i=0; i<4; i++){
			System.out.print(Thread.currentThread().getName());
			System.out.println(" : " + i);
			Thread.yield();
		}
	}
    
}

⌨️ 快捷键说明

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