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

📄 examthread2.java

📁 JAVA程序设计 丁岳伟 彭敦陆编 高等教育出版社 第7---11章程序
💻 JAVA
字号:
//ExamThread1.java
import java.util.*; 
public class ExamThread2 implements Runnable{
	String threadName; 
	public ExamThread2(String threadName){ 
		this.threadName=threadName;
		System.out.println(threadName+ "created!");
	} 
	public void run(){
		System.out.println(threadName+"started!");
		try { 
			Thread.sleep(1000); 
		}catch(Exception e){
			e.printStackTrace(); 
		} 
		System.out.println(threadName+" finished!");
	}
	public static void main(String args[]){ 
		ExamThread2 target1 = new ExamThread2 ("first thread "); 
		ExamThread2 target2= new ExamThread2 ("second thread "); 
		ExamThread2 target3= new ExamThread2 ("third thread "); 
		Thread first,second, third;
		first=new Thread(target1);
		second=new Thread(target2);
		third=new Thread(target3);
		first.start( );
		second.start( );
		third.start( );
	}
}

⌨️ 快捷键说明

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