I am writing my Servlet application and would like to use the following static method which will multiply x and y.
public class Helper {
private Helper() {
throw new AssertError();
}
public static int mutltiply(int a, int b) {
int c = a*b;
return c;
}
}
I understand that Servlets is a multi-threaded environment. Is it safe to call such a method from a servlet?
Should I add a synchronize property to this function? My concert deals with the value of the variable c in multithreading.
I am new to Java, so this information will be very helpful.
Danny
source
share