Zack, I made a mistake in my previous code post. I used 'Thread.sleep()' in the Worker class, but I've changed it to 'sleep()', so take a look at the code sample again please
The idea was to show that in class Runner you need to use the static method 'Thread.sleep(), while in the Worker class you can simply use the class's 'sleep()' method.
The code shows the difference between subclassing and implementing an interface.
To follow up on your latest reply, there are a few concepts in work here that
you should clear up!
1. Know what subclassing does for you
2. Understand the difference between subclassing and implementing an interface in
Java 3. Know what a class static method is and how they are used, in other words, no instance reference is required!
4. Look at class Object, it defines the methods wait() and notify()....all java class are subclass of class Object (that's a given)
The following code will output a value of 'true', this proves that class A 'is-a' a subclass of class Object.
class A {}
A a = new A();
System.out.println(a instanceof Object);
(*) javac converts the definition 'class A' to 'class A extends Object' on your behalf
This reply is somewhat terse, and I'm sure you already know the first 3 things I listed, but it's gives you some things to think about
[ March 03, 2002: Message edited by: Rajinder Yadav ]