Java null check
问题 I have one thread1 : if(object != null){ object.play(); } and another thread2 that can write null into object reference at any time. I will run these threads at same time. I know thread2 can rewrite object reference after the null check and that will throw NullPointerException . Is it possible for thread2 to rewrite object reference after NullPointerException check? 回答1: Is it possible to for thread2 to rewrite object reference after NullPointerException check ? Absolutely - it could change