I see the discussion here has come down to a discussion of the singleton pattern :)
Actually, if you answer the question " How does a static method behave in a multithreaded application? " You need to know the following:
1) From the static method, only static fields and methods are available, so problems can arise only with them (or else with the parameters and objects passed to the method, stored in local variables, but this does not depend on the use of static), or more precisely, with entries in static fields. In the above example, the entry in such a field occurs only once - when the class is loaded.
2) Using the synchronized static method is absolutely equivalent to using a class object as a mutex. The following two methods work identically:
class Example{ static void foo(){ synchronized(Example.class){ //method body } } synchronized static void bar(){ //method body } }
3) Without using synchronized in a method or with a method, calling its code is no different in terms of multithreading from calling an ordinary method.
Finally, I will propose another way to implement the singleton pattern, which in my opinion is very elegant and effective - no problems with initialization / multithreading.
enum Singleton{ Instance; //methods }