@Override
public void run() {
int sum = 0;
for(int i=start;i<=end;i++){
sum+=i;
}
System.out.println(Thread.currentThread().getName()+"计算"+start+"到"+end+"的和为:"+sum);
}
}
public class Test {
public static void main(String[] args) {
MyRunnable myRunnable1 = new MyRunnable(1,100);
MyRunnable myRunnable2 = new MyRunnable(1,100);