John Jai wrote:Before going to the context, I notice you have tried to set a code tag but unsuccessful using [cpde]. To use code tags you can easily select the fragment you have to highlight as code and then click the Code button.
1. The printStackTrace() method does not return a String but is void and hence you cannot send it as a String argument to another method.
2. The second error is because the errorMsg() method throws an Exception which you do not handle. You should handle it in the catch clause again. Or include a throws Exception clause in the method declaration similar to one you have in errorMsg() method.
Jesper de Jong wrote:Interface Throwable has several printStackTrace() methods. The version without arguments prints the stack trace to System.err and does not allow you to get the stack trace in a string. There is however also a version that takes a PrintWriter, which you can use like this:
Joanne
Farakh khan wrote:this block reporting exception:
Joanne
Farakh khan wrote:its working but I lost my objective to get the exception in my email
Joanne
Farakh khan wrote:
it again throws
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Joanne
Joanne Neal wrote:And more generally, always try to avoid throwing or catching Exception. Make the exception type as specific as possible. Especially as Java 7 allows you to do multiple catches in a single statement.