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

📄 ss.txt

📁 操作系统的部分实验源码 希望你们会喜欢 学操作系统必备的
💻 TXT
字号:

public class Thread_1 extends Thread
{
	public static int sum=0;
	public static int n=0;
	public static int m=0;
	public static int i=0;
	public static boolean pd=true;
	public int id;
	
	public Thread_1(int id)
	{
		this.id=id;
	}
	
	public synchronized void run()
	{
		for (;n<101;n++)
			sum=sum+n;
		for(;m<1000;m++)
		{
			for(i=2;i<m;i++)
				if(m%i==0)
					break;
			if(i==m)
				System.out.println("id is "+id+"\t number is "+m);
		}
		if(pd==true)
		{
			System.out.println("\nsum is "+Thread_1.sum);
			pd=false;
		}
	}
	
	public static void main(String args[])
	{
		Thread_1 t1=new Thread_1(1);
		Thread_1 t2=new Thread_1(2);
		//Thread_1 t3=new Thread_1(3);
		t1.start();
		t2.start();
		//t3.start();
	}
}

⌨️ 快捷键说明

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