... import java.util.Scanner;
public class Driver { public static void main(String[] args) {
Sum sumObject = new Sum();
int upper = Integer.parseInt(args[0]);
Thread child = new Thread(new Summation(upper, sumObject));
child.start();
try {
child.join();
System.out.println ("total: " + sumObject.getSum()));
} } catch (InterruptedException e) {
}
}
} ...
I'm running the Java thread example above code, but I keep getting errors. Why is that error coming up?
java
An error message in question is an exception that occurs when dealing with an array.
The ArrayList or array is created only, but the actual array does not seem to have any values registered.
The code in the question does not contain any code that deals with the array, so please upload the code in the Summation class.
© 2024 OneMinuteCode. All rights reserved.