intJava中的volatile是否是线程安全的?也就是说,可以安全地读取和写入而不锁定吗?
假设我有一个类,其中has方法以如下方式同步.
public class Test{
    public static synchronized void method1(){
    }
    public static synchronized void method2(){
    }
    public synchronized void method3(){
    }
    public synchronized void method4(){
    }
}
所以,当两个线程调用场景method1和method2simultaneously.I觉得只是方法之一被允许call.What会是这样的,如果他们打电话method1和method3.Will那里是同样的情景也在这里?会是怎样的情况下,与method3和method4来自同一个对象?