Activity 01
Pair Programming: File Reader Safeguards
Pairs write a program to read user-specified files, wrapping file operations in try-catch blocks. They test with invalid paths and missing files, then log errors and prompt users for corrections. Extend by creating a custom FileNotAccessibleException.
Explain the importance of robust error handling in user-facing applications.
Facilitation TipDuring Pair Programming: File Reader Safeguards, circulate and ask pairs to explain why their chosen exception type matches the error scenario, not just that it works.
What to look forPresent students with a code snippet containing a potential runtime error (e.g., division by zero). Ask them to identify the error and write the correct try-catch block to handle it, explaining their choice of exception type.