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

📄 201f5bded069001c1989d8a2fa4db5ce

📁 这是我自己照着书上敲的
💻
字号:
/*
 * Created on 2007-9-23
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */

/**
 * @author Administrator
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class ThreadApplication 
{
	public static void main(String args[])
	{
		MyThread thread1=new MyThread();
		MyThread thread2=new MyThread();
		thread1.set('1',100);
		thread2.set('2',50);
		thread1.start();
		thread2.start();
	}
}
class MyThread extends Thread
{
	char c;
	int time;
	int count=0;
	public void set(char _c,int _time)
	{
		c=_c;
		time=_time;
	}
	public void run()
	{
		//System.out.println(this.toString());
		for(count=0;count<=10;count++)
		{
			System.out.print(""+c);
			try
			{
				sleep(time);
			}
			catch(InterruptedException e)
			{
				e.printStackTrace();
			}
		}
	}
}

⌨️ 快捷键说明

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