I have a web application running on Tomcat.
There are several calculations that need to be done on multiple places in the web application. Can I make those calculations
In the first case you don't have to worry about threading issues, because the variables are local to each thread. You correctly identify the problem in the second case, though, because multiple threads will be reading/writing the same object. Synchronizing on the methods will work, as would synchronized blocks.