假设我有一个Utility类,
public class Utility {
private Utility() {} //Don't worry, just doing this as guarantee.
public static int stringToInt(String s) {
return Integer.parseInt(s);
}
};
Run Code Online (Sandbox Code Playgroud)
现在,假设在一个多线程应用程序中,一个线程调用,Utility.stringToInt()方法,当操作进入方法调用时,另一个线程调用相同的方法传递一个不同的s.在这种情况下会发生什么?Java会锁定静态方法吗?