Java Throwable getMessage() methodThe getMessage() method of Java Throwable class is used to get a detailed message of the Throwable. SyntaxReturnIt returns a detailed message string of the Throwable instance (which may be NULL). Example 1Test it NowOutput: / by zero Example 2Test it NowOutput: For input string: "Java" java.lang.NumberFormatException: For input string: "Java" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) at java.lang.Integer.parseInt(Integer.java:615) at ThrowableGetMessageExample2.main(ThrowableGetMessageExample2.java:5)
Next TopicJava Throwable
|