Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how come i cannot use printStackTrace in a constructor?

 
Mindy Wu
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
A Agrawal
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Sam Dalton
Author
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use e.printStackTrace(System.out)
where e is your exception
 
What's wrong? Where are you going? Stop! Read this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!