Datasets:
ArXiv:
License:
Download data/train/akash-coded/FSD_Java/Misc/ExceptionHandling.java from RepoFusion/Stack-Repo: direct link, hf CLI and curl.
- Browser
- Download file 779 Bytes
-
https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Misc/ExceptionHandling.java
- Command line
-
hf download hf://datasets/RepoFusion/Stack-Repo@bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Misc/ExceptionHandling.java
-
curl -L -o ExceptionHandling.java https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Misc/ExceptionHandling.java
779 Bytes
| import java.io.IOException; | |
| public class ExceptionHandling { | |
| private static String printEvenOrOdd(int digit) throws IOException { | |
| // try { | |
| // System.out.println(5 / 0); | |
| // } catch (Exception e) { | |
| // System.out.println("Exception handled in printEvenOrOdd"); | |
| // } | |
| // System.out.println(5 / 0); | |
| throw new IOException(); | |
| // return (digit % 2 == 0) ? "Even" : "Odd"; | |
| } | |
| public static void main(String[] args) { | |
| System.out.println("Before Exception Occurs"); | |
| try { | |
| System.out.println(printEvenOrOdd(5)); | |
| } catch (Exception e) { | |
| System.out.println("Exception handled in main"); | |
| } | |
| System.out.println("After the exception has occurred"); | |
| } | |
| } | |