Every time you invoke a class containing the main() method you are running your compiled bytecode on a single thread called the main thread. When it comes to threads, the main thread is super important. Java gives us the ability to create and spawn child threads from the main thread. Why on earth would we want to create additional threads? The answer to that question is only learned through experience ... the kind of experience that makes your program appear to be hung up in an endless loop! Let me give you a couple of examples.
...
At the top of the thread hierarchy is a class named Thread and an interface named Runnable. Every thread has a life cycle. The life cycle of a thread is well defined into a total of six states:
NEW - A thread has been declared, but has not yet started is in this state.
RUNNABLE - In this state a thread is executing in the JVM.
BLOCKED - In this state a thread is blocked waiting for a monitor lock or intrinsic lock. I'll explain in later down the road.
WAITING - A thread that is waiting indefinitely for another thread to perform a particular action is in this state.
TIMED WAITING - A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state.
TERMINATED - A thread that has exited is in this state.
In questa pagina del sito puoi guardare il video online Learn Java Programming - Introduction to Multithreading Tutorial della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Daniel Ross 18 dicembre 2015, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,540 volte e gli è piaciuto 18 spettatori. Buona visione!