View Full Version : Threads in Java

02-19-2003, 05:22 PM
If I created a subclass called testThread, put a counter in it that increments every 100 milliseconds, and add a public method to retrieve the counter value, would the following be correct?

class clockThread extends Thread {

int counter = 0;

public clockThread(int number) {

while(true) {

counter = number;
try {
catch ( InterruptedException e) {}
counter ++


How would I create an applet that has two instances of testThread and uses the paint method to display the counters in two threads? How would I adjust the priorities of the two threads?

Your help in understanding this will be appreciated.

02-19-2003, 05:46 PM
Try to put this message in the "Computer Programming" Forum

02-19-2003, 08:29 PM
Well, thanks for the reply; but .... I do not have permissions to move this thread. Can the administrator help by moving this thread to Computer Programming? If any one in this forum has a solution to the initial question, that would be great.