Understanding multithreading is difficult if you have never seen Java code with multiple threads. Threads have to be coded by the developer and is not taught at high school level.

These two programs also use inheritance.

Using Gogga is a useful way to demonstrate threads because three bugs are created and each is commanded to move. In the first version (with only one default thread) each bug has to move one after the other.

Java gogga with one thread

Click here for the code.

In the second version with three threads each bug can move at the same time as one another.

Because Gogga is not 100% thread safe you can see a few glitches when compared to version one but nevertheless the illustration is still useful.

Click here for the code for the version with three threads, one for each bug