Hi Mike,
So... gotta minute (or a whole bunch of minutes?)
First, the reason you're getting all zeros: in Driver.main(), "list" and "work" refer to two different instances of ThreadApp, each with their own copy of the member variables threadNum, threadStart, threadEnd, etc. The ones you're printing out are stored in "list"; the ones you're actually setting are stored in "work." The "list" ones are never set. If you don't understand this,
stop. Don't worry about threads until that sort of basic object-oriented stuff is clear to you.
If that was just a momentary lapse of reason, then we'll move onto non-thread-related issue number two. Objects should hold their own individual data; it's very non-Java-like to use an array in a class to hold a list of values for the instances of a class. Why not have ThreadApp look like this:
For this class, main() would supply a unique id for each of five Runnables; each would hold all its own data. Instead of using toString() to print all five results, I'm letting it print the results for just the one object; main() would need a loop over the five Runnables (by the way, main() would hold the five Runnables in an array.) Make sense? That's the
Java way of doing things.
One more non-thread-related things: a Date object represents a specific date and time; by default, the instant it was constructed. Calling getTime() on a Date will always return that same time; it won't update as time passes. Use System.currentTimeMillis() for that.
Now, the thread stuff: threads are complicated. You
can not let two threads read and write the same variable (as happens here many times) without using some form of synchronization.
This lesson in Sun's Java Tutorial should give you an idea of the issues involved.
Anyway, there's just so much wrong here that there's no quick answer on how to fix it. Slow down a bit, take your time, walk before you run, etc. You'll get there, don't worry!
}