main.java

来自「使用多线程技术计算100000之间的所有素数的个数」· Java 代码 · 共 44 行

JAVA
44
字号
/*
 * Main.java
 *
 * Created on 2007年3月20日, 下午2:29
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package primethread;
import primethread.Prime;
/**
 *
 * @author 新
 */
public class Main {
    
    /** Creates a new instance of Main */
    public Main() {
    }
    
    /**
     * @param args the command line arguments
     */
   public static void main(String[] args){
        // TODO code application logic here
        Prime prime1=new Prime(1,20000);
        Prime prime2=new Prime(20001,40000);
        Prime prime3=new Prime(40001,60000);
        Prime prime4=new Prime(60001,80000);
        Prime prime5=new Prime(80001,100000);
        Thread thread1=new Thread(prime1,"线程1");
        Thread thread2=new Thread(prime2,"线程2");
        Thread thread3=new Thread(prime3,"线程3");
        Thread thread4=new Thread(prime4,"线程4");
        Thread thread5=new Thread(prime5,"线程5");
        thread1.start();
        thread2.start();
        thread3.start();
        thread4.start();
        thread5.start();
   }
}
   

⌨️ 快捷键说明

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