Sort Race:  Multi-thread Demo

Adapted from Sun's On-line Java Tutorial: Essential Java Classes: Doing Two or More Tasks At Once: Threads

Below are three copies of an applet that animates different sorting algorithms.  No, this lesson is not about sorting algorithms.  But these applets do provide a visual aid to understanding a powerful capability of the Java language--threads.

Bubble Sort

Bubble Sort

Your browser doesn't understand the APPLET tag.

      Quick Sort

Now start each of the applets, one by one, by clicking on them with the mouse.  Notice anything? Yes! The applets are running side by side at the same time!  Notice anything else?  Yes!  You can also scroll this page or bring up one of your browser's panels at the same time that the three sorting applets sort their data.  All of this is due to the power of threads.