Multi-Threading
Java is multi-threaded.
There are two ways to work with threads:
- Create a class that extends the Java "Thread" class
- Create a class that implements Runnable
In both cases:
- The new class must overload the "run" method
- Each object of the class created with "new" is a separate thread
- A thread is started by calling its "start" method
- A thread is stopped by calling its "stop" method
- Thread synchronisation is available ("join", "yield" etc.)