This can’t be answered in just a blog entry but I try to give a quick overview.
At some point you will learn about concurrent programming. The Java Memory Model is the essential concept you need to learn. But it’s no easy to grasp as a beginner. I try to explain some of the most important aspects.