Joke Collection Website - Blessing messages - How to pass messages between threads in java

How to pass messages between threads in java

Native Java threads can only communicate through shared memory (within the same virtual machine). Of course, you can also do it yourself, making the threads seem to communicate through messages. For example, Scala's Actor can be passed by message, but the Actor itself is very different from threads, but it seems that it has some functions of thread.