Thread Libraries

The Java Driver program at https://www.sci.brooklyn.cuny.edu/~briskman/cisc/3320/lecture_notes/topic_05/Driver.java creates a thread (besides the main thread) that runs a method that sums up all the integers between 1 and our input integer, inclusively. For example, at the input of 5, the sum 1+2+3+4+5=15 will be returned.

It does so by creating the SummationThread class that extends the Thread class. The sum is computed inside the run() method of the class and is executed when we call the start() method on the SummationThread object that we create inside the main() function. We then call the getSum() method on this object to return and print the result of the summation.

When running the program using the command line/terminal, the argument to the program should be the greatest integer of those we are summing. For example, calling:
java Driver 5
will output: sum = 15 since 1+2+3+4+5=15.