I am sometimes getting a null-pointer exception when changing levels in the game. Only sometimes. I don’t understand what can be the possible reason. Even after getting NPE the game runs fine. I think that it is caused maybe because the update method is called while the game is still repainting. So I want to know is it possible in java that update is called before re-paint is completed ?