Java Multithreading
Several threads will share a single object and contribute theirindividual result to the shared object. The shared objectaccumulates the partial results.
Create a class named SharedResults as follows. The class keepstrack of the shared result. a. The instance (or member) privatevariable – result (int). b. A void addToResult method which takesthe given integer argument and adds it to the shared result. Thismethod then prints to the console the name of the current thread,the value it added, and the cumulative result. Handle thesynchronization issue with this method. c. The getResult methodwith no arguments which returns the shared result. Handle thesynchronization issue
OR
OR