Creating
a Thread
|
|
|
|
A thread is a basic processing unit to
which an operating system allocates processor time, and more than one thread
can be executing code inside a process. (Java 5: A Beginner's Tutorial by
Budi Kurniawan Brainy Software Corp. 2006 |
|
Every Java program has at least one thread,
the thread that executes the Java program. It is created when you invoke the
static main method of your Java class. |
|
There are two ways to create a thread. |
|
|
|
|
|
Every Thread has a state and a Thread can
be in one of these six states. |
|
|
|
The values that represent these states are
encapsulated in the java.lang.Thread.State enum. The members of this enum are
NEW, RUNNABLE, BLOCKED, WAITING, TIMED__WAITING, and TERMINATED. |
Wednesday, 7 December 2016
Chapter 12:0 Thread - Creating a Thread
Labels:
JAVA tutorial
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment