diff --git a/core-java/src/main/java/com/baeldung/core/exceptions/FileNotFoundExceptionExample.java b/core-java/src/main/java/com/baeldung/core/exceptions/FileNotFoundExceptionExample.java new file mode 100644 index 0000000000..2ac4e49869 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/core/exceptions/FileNotFoundExceptionExample.java @@ -0,0 +1,20 @@ +package com.baeldung.core.exceptions; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; + +public class FileNotFoundExceptionExample { + + public static void main(String[] args) throws IOException { + BufferedReader rd = null; + try { + rd = new BufferedReader(new FileReader(new File("notExisting"))); + rd.readLine(); + } catch (FileNotFoundException ex) { + ex.printStackTrace(); + } + } +} \ No newline at end of file