# Java Exceptions and File Handling Workshop ## Introduction This workshop is designed to help students become familiar with **exception handling** and **basic file operations in Java**. It provides small demo programs and guided exercises that demonstrate how common runtime exceptions occur and how they should be handled in real applications. The workshop also includes a **file handling guide**, showing how Java can interact with files on the system and how to work with JSON data. --- ## Workshop Structure The workshop consists of two main sections: ### 1. Exception Handling This section contains demonstration code that intentionally produces different types of runtime exceptions. Students are expected to analyze the code and apply proper **exception handling techniques**. The examples include scenarios such as: - `NullPointerException` - `IllegalArgumentException` - `ArithmeticException` - `NumberFormatException` - `IllegalStateException` ### 2. File Handling Guide The second section of the workshop introduces common **file system operations in Java**. Unlike the exception section, this part is mainly **instructional** and does not contain required exercises. Topics covered include: - **AddressingModes** Understanding relative and absolute file paths. - **CreatingFiles** How to create files programmatically using Java. - **DeletingFiles** Removing files from the file system safely. - **ReadingFiles** Reading data from text files using Java IO classes. - **WritingFiles** Writing content to files. - **ParsingJson** Basic techniques for working with JSON files in Java. These examples are intended to serve as **reference material** for future projects. --- ## Tasks Students may optionally complete the following tasks: 1. Review the provided exception demo code. 2. Identify where runtime exceptions occur. 3. Modify the `FileService` methods by: - Uncommenting the provided code - Adding appropriate exception handling 4. Test the program to ensure that errors are handled gracefully. ### Important Notice Completing and submitting this workshop is **NOT mandatory** and **does not carry any points or grading**. It is provided purely as a **learning exercise** to help students better understand Java exception handling and file operations. --- ## Learning Goals By working through this workshop, students should be able to: - Understand common Java runtime exceptions - Apply `try-catch` blocks correctly - Handle file-related exceptions - Perform basic file operations in Java - Understand how Java programs interact with JSON files ```