how come i cannot use printStackTrace in a constructor?
Joined: Jan 12, 2001
I have a some jdbc stuff in my constructor and i want to use printStackTrace in my catch block so that i can see the error msg. However, it is not working and here is the msg i saw after compiling "'void' type not allowed here". Can anyone explain to me how to use printStackTrace()? Thank you!
Joined: Jul 13, 2001
I think you are passing printStackTrace() as a parameter to System.out.println().just check your code, if you are doing so. Actually simple printStackTrace() is enough and you need not pass it to System.out.println() for printing it. If you still hv this problem, plz post the code you hv written in catch block.
------------------ Amit Agrawal, New Delhi, India. [This message has been edited by A Agrawal (edited July 27, 2001).]
Amit Agrawal,<BR>New Delhi, India.
Joined: Jul 26, 2001
Use e.printStackTrace(System.out) where e is your exception
<a href="http://www.samjdalton.com" target="_blank" rel="nofollow">Sam Dalton</a>,<br />Co-author of [http://www.amazon.com/exec/obidos/tg/detail/-/1590592255/qid=1068633302//ref=sr_8_xs_ap_i0_xgl14/104-4904002-9274339?v=glance&s=books&n=507846]Professional JSP 2.0[/URL] (October 2003)<br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/1861007701/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional SCWCD Certification</a><br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/186100561X/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional Java Servlets 2.3</a>