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

📄 thread.java

📁 java学习的作业 1.runnable和thread的使用区别 2.interf和commo的使用 3.用java实现画图程序
💻 JAVA
字号:
import java.lang.Thread;
class mythread extends Thread{
	mythread(String str){
		super(str);
		this.start();
		
	}
	public  void run(){
		int i;
		for(i=1;i<=5;i++)
		{
			System.out.println("subThread:"+i);
			try{
				sleep(100);
			}
			catch(InterruptedException e){
			}
		}
	}
}

class mainthread extends Thread{
	public static void main(String args[])
	{
		new mythread("subthread");
		int i;
		for(i=1;i<=5;i++)
		{
			System.out.println("mainthread:"+i);
			try{
				sleep(100);
			}
			catch(InterruptedException e){
			}
		}
	}
	
}

⌨️ 快捷键说明

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