Lets say I have a class like this in Java:
public class Function {
public static int foo(int n) {
return n+1;
}
}
What happens if I call the foo method like this from a thread?
x = Function.foo(y);
Can I do that with two threads, without them waiting for each other? Let's say that foo takes a while, and that it gets called a lot, so that each thread would would likely be trying to use foo at the same time. Can they do that, or do I have to make all the methods in Function instance methods and give each thread it's own Function object?