I wrote this article for SitePoint’s Java channel, where you can find a lot of interesting articles about our programming language. Check it out!
In a running Java program, all code is executed in threads and within a thread everything happens sequentially, one instruction after another.
When Java (or rather the JVM) launches, it creates one thread for the
main method to be executed in.
From there, new threads can be created to execute code in parallel to the main one.
The most basic way to do that is to use the