Why does public void printStackTrace(PrintStream s) in the Throwable class take a PrintWriter, instead of a Writer?
I think Writer should be the norm (code to the interface, not a specific implementation), but it could be something that I’m missing, hence this question.
Writeris an abstract class whichPrintWriterextends.Throwable.printStackTracetakes aPrintWriterbecause it calls theprintlnmethod on it which is not available in theWriterclass.printlnis called because it needs to print the stack trace, one stack frame per line.