Datasets:
ArXiv:
License:
Stack-Repo / data /train /akash-coded /FSD_Java /Lesson-3 /Exception Handling /Examples /TryCatchExample3.java
Download data/train/akash-coded/FSD_Java/Lesson-3/Exception Handling/Examples/TryCatchExample3.java from RepoFusion/Stack-Repo: direct link, hf CLI and curl.
- Browser
- Download file 527 Bytes
-
https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-3/Exception%20Handling/Examples/TryCatchExample3.java
- Command line
-
hf download 'hf://datasets/RepoFusion/Stack-Repo@bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-3/Exception Handling/Examples/TryCatchExample3.java'
-
curl -L -o TryCatchExample3.java https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-3/Exception%20Handling/Examples/TryCatchExample3.java
527 Bytes
| /** | |
| * In this example, we also kept the code in a try block that will throw an | |
| * exception. | |
| */ | |
| public class TryCatchExample3 { | |
| public static void main(String[] args) { | |
| try { | |
| int data = 50 / 0; // may throw exception | |
| // if exception occurs, the remaining statement will not exceute | |
| System.out.println("rest of the code"); | |
| } | |
| // handling the exception | |
| catch (ArithmeticException e) { | |
| System.out.println(e); | |
| } | |
| } | |
| } |