Professional Documents
Culture Documents
ti
ti
this.endIndex = endIndex;
this.sum = 0;
@Override
sum += numbers[i];
return sum;
int[] numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
int startIndex = 0;
int endIndex = 2;
int totalSum = 0;
thread1.start();
thread2.start();
thread3.start();
ti
try {
thread1.join();
thread2.join();
thread3.join();
} catch (InterruptedExcep on e) {
e.printStackTrace();
}
Result/Output:
Result:
successfully executed
ti