2026-05-15 17:49:01 +03:30
2026-05-08 18:53:12 +03:30
fix
2026-05-15 17:48:54 +03:30
2026-05-15 17:30:41 +03:30
2026-05-10 16:35:22 +03:30
2026-05-10 16:35:22 +03:30
2026-05-15 17:30:41 +03:30
2026-05-15 17:49:01 +03:30

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
S
Description
No description provided
Readme
48 KiB
Languages
Java 100%