Win a copy of Learn Spring Security (video course) this week in the Spring 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic