Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

difference in Exception toString and getMessage

807598May 31 2006 — edited May 31 2006
Hi,

Is there a difference to Exception toString and getMessage ? Following code produces the same output if I trow an exception like this:
    throw new IndexOutOfBoundsException("Cannot read RecordList, is empty");
    // ...
} catch (Exception e) {
    log(e.toString() + " " + e.getMessage());
It then output 2 time the string I have given as argument in the constructor of the Exception. If both are the same, what is preferred ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 28 2006
Added on May 31 2006
4 comments
1,457 views