Datasets:
ArXiv:
License:
Stack-Repo / data /train /akash-coded /FSD_Java /Lesson-3 /Exception Handling /Assisted Practice Problems /CustomExceptionDemo.java
Download data/train/akash-coded/FSD_Java/Lesson-3/Exception Handling/Assisted Practice Problems/CustomExceptionDemo.java from RepoFusion/Stack-Repo: direct link, hf CLI and curl.
- Browser
- Download file 495 Bytes
-
https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-3/Exception%20Handling/Assisted%20Practice%20Problems/CustomExceptionDemo.java
- Command line
-
hf download 'hf://datasets/RepoFusion/Stack-Repo@bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-3/Exception Handling/Assisted Practice Problems/CustomExceptionDemo.java'
-
curl -L -o CustomExceptionDemo.java https://huggingface.co/datasets/RepoFusion/Stack-Repo/resolve/bbc90aef76314892f2d54f85da32b81503fb7eb3/data/train/akash-coded/FSD_Java/Lesson-3/Exception%20Handling/Assisted%20Practice%20Problems/CustomExceptionDemo.java
495 Bytes
| class MyException extends Exception { | |
| /** | |
| * Default serial ID | |
| */ | |
| private static final long serialVersionUID = 1L; | |
| public MyException(String s) { | |
| super(s); | |
| } | |
| } | |
| public class CustomExceptionDemo { | |
| public static void main(String args[]) { | |
| try { | |
| throw new MyException("I am a custom exception"); | |
| } catch (MyException ex) { | |
| System.out.println("Caught"); | |
| System.out.println(ex.getMessage()); | |
| } | |
| } | |
| } | |