September 2011
Beginner
650 pages
15h 47m
English
You create a thread by instantiating an object of type Thread. The Thread class encapsulates an object that is runnable. As mentioned, Java defines two ways in which you can create a runnable object:
You can implement the Runnable interface.
You can extend the Thread class.
Most of the examples in this chapter will use the approach that implements Runnable. However, Try This 11-1 shows how to implement a thread by extending Thread. Remember: Both approaches still use the Thread class to instantiate, access, and control the thread. ...
Read now
Unlock full access