A suggestion for testing:
Change the values assigned to rand1 and rand2 to be constants instead of random so that the math is always the same. That will allow you to work on the threads and not...
Type: Posts; User: Norm
A suggestion for testing:
Change the values assigned to rand1 and rand2 to be constants instead of random so that the math is always the same. That will allow you to work on the threads and not...
What variable has a null value on line 21?
That looks like the way to call a method in the Stock class:
stock.buy (rand1 , rand2);
The above shows the NPE happened at line 21 in BuyThread and line 22 in SellThread. Look at those lines and find the variables that have null values. If you can't see which variables are null, add...
Have you looked at the source code lines referenced in the error messages and found the variables that have null values?
When you find the variables with the null values, then back track in the...
Please copy the full text of the error message and paste it here. It has important info about the error.