Datasets:
ArXiv:
License:
Stack-Repo / data /train /akash-coded /FSD_Java /Lesson-3 /Exception Handling /Assisted Practice Problems /ThrowsDemo.java
Download data/train/akash-coded/FSD_Java/Lesson-3/Exception Handling/Assisted Practice Problems/ThrowsDemo.java from RepoFusion/Stack-Repo: direct link, hf CLI and curl.
- Browser
- Download file 517 Bytes
-
https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-3/Exception%20Handling/Assisted%20Practice%20Problems/ThrowsDemo.java
- Command line
-
hf download 'hf://datasets/RepoFusion/Stack-Repo@bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-3/Exception Handling/Assisted Practice Problems/ThrowsDemo.java'
-
curl -L -o ThrowsDemo.java https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-3/Exception%20Handling/Assisted%20Practice%20Problems/ThrowsDemo.java
517 Bytes
| public class ThrowsDemo { | |
| void division() throws ArithmeticException { | |
| int a = 45; | |
| int b = 0; | |
| int rs; | |
| rs = a / b; | |
| System.out.print("\n\tThe result is : " + rs); | |
| } | |
| public static void main(String[] args) { | |
| ThrowsDemo obj = new ThrowsDemo(); | |
| try { | |
| obj.division(); | |
| } catch (ArithmeticException ex) { | |
| System.out.print("\n\tError : " + ex.getMessage()); | |
| } | |
| System.out.print("\n\tEnd of program."); | |
| } | |
| } | |