Today I met some multithreading problems. Many Java syntax become very confusing in a multithreading environment. So I created a mini Java program, and wrote this study note to clarify the unclear methods. This blog post will go through the following steps:
- Source code and execution
- Understand logic sharing
- Understand variable sharing
Today, I want to share with you an introduction to multithreading in Java. In order to make the blog post more fun, I'll use the roles of "Game of Thrones" in my examples: white walkers and the Night King. After reading the blog post, you'll understand: How to create and run a thread, use wait(), notify(), notifyAll() and join().