package com.threadPool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadPoolTest {

public void mainMethod(){
//获取线程池类
ExecutorService threadPool = Executors.newFixedThreadPool(5);
String str = "hello";
//执行方法
AutoTest autoTest = new AutoTest(str);
threadPool.execute(autoTest);
}

public void syso(String str){
System.out.println(str);
}

class AutoTest implements Runnable{
private String str;
public AutoTest(String s){
str = s;
}
@Override
public void run() {
syso(str);
}
}

}