Monday, November 19, 2012

Fifth lab: Multithreading in Java

This new lab is about how can we create a Java program that can handle more than one execution flow (or thread). Sometimes we need our program to do two things are once (ie. wait for more clients while handling the one client already connected) and multi-thread programs can do this.

The idea is that a given class that inherits from Thread class can re-write the public void run() method with the desired code for a thread. Then you can instantiate and start several objects to run the same code.

No comments:

Post a Comment