The printStackTrace method is a method of the Throwable class - the superclass of all Exceptions. Basically, it just prints out where the Exception in question occurred by giving you the list of method calls that resulted in the Exception being thrown. It's very useful for debugging! Incidentally, it's got nothing to do with the numbers your code is printing out - they're from the running thread's run method, which is just incrementing i and printing the result...
Do I need to know what the methods fillInStackTrace() and printStackTrace() do for the exam? Do I also need to know how to throw an object of type Throwable for the exam? [ March 26, 2003: Message edited by: Karin Paola Illuminate ]
I not only use all the brains that I have, but all that I can borrow. [Laurence J. Peter]
Write code that makes proper use of exceptions and exception handling clauses (try, catch, finally) and declares methods and overriding methods that throw exceptions.
Recognize the effect of an exception arising at a specified point in a code fragment. Note: The exception may be a runtime exception, a checked exception, or an error (the code may include try, catch, or finally clauses in any legitimate combination).
So... you definitely need to know how to use a try /catch block -- and the finally clause too. You should understand the difference between checked / unchecked exceptions -- (and the basic Exception class hierarchy too). However (according to the Sierra/Bates book) For th exam, it is not necessary to know any of the methods contained in the class Throwable... You are expected to know tha Exeption, Error, RuntimeException, and Throwable types can all be thrown using the throws keyword, and can all be caught (although you rarely will catch anything other than Exception subtypes).