| 1234567891011121314151617181920212223 |
- package course;
- import java.util.concurrent.Callable;
- /**
- * @author WanJl
- * @version 1.0
- * @title CallableImpl
- * @description
- * @create 2026/8/8
- */
- public class CallableImpl implements Callable<Integer> {
- @Override
- public Integer call() throws Exception {
- int sum=0;
- for (int i = 0; i < 100000; i++) {
- sum+=i;
- }
- String name = Thread.currentThread().getName();
- System.out.println(name+"---任务中-->"+sum);
- return sum;
- }
- }
|