• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how come i cannot use printStackTrace in a constructor?

 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
Author
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use e.printStackTrace(System.out)
where e is your exception
 
Thanks tiny ad, for helping me escape the terrible comfort of this chair.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic