diff options
| author | Kamal Wickramanayake <kamal@inbox.lk> | 2026-02-21 20:33:23 +0530 |
|---|---|---|
| committer | Kamal Wickramanayake <kamal@inbox.lk> | 2026-02-21 20:33:23 +0530 |
| commit | 530141c542ab3b44991f05016e66db651795e9c9 (patch) | |
| tree | abf4953878cd274d06d890c3bcad4e0230b30943 /java/12-error-handling-2/MathsTest6.java | |
| parent | 3625bc6cbddd473659b3f584c0dbec515c07c786 (diff) | |
Added java/collections and java/error handling sample code
Diffstat (limited to 'java/12-error-handling-2/MathsTest6.java')
| -rw-r--r-- | java/12-error-handling-2/MathsTest6.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/java/12-error-handling-2/MathsTest6.java b/java/12-error-handling-2/MathsTest6.java new file mode 100644 index 0000000..7f176aa --- /dev/null +++ b/java/12-error-handling-2/MathsTest6.java @@ -0,0 +1,22 @@ +public class MathsTest6 { + + /** + * @param args + */ + public static void main(String[] args) { + Maths m = new Maths(); + int result = 0; + + try { + result = m.factorial(-5); + } catch(MathsException me) { + System.err.println("Factorial method failed"); + System.exit(1); + } finally { + System.out.println("Inside finally block"); + } + + System.out.println(result); + } + +} |
