Skip to main content
CMP175
Unit 5 of 8
6 Hours

Exception Handling

5 topics5 videos3 assignments
5.1

Introduction to Exception

Lecture
5.2

Errors in Java Programs

Lecture
5.3

Exception in Java Programs

Lecture
5.4

Exception Handling Mechanism

Lecture1 assignment

Assignment

Exception Handling Mechanism: Full Flow Program

Assignment BriefDue: Complete before Topic 5.5 (Built-in and User Defined Exceptions in Java)

Exception Handling Mechanism: Full Flow Program

Build one Java program that uses try, catch, finally, throw, and throws. Include a method that validates input (for example age or marks) and throws an exception for invalid data. Catch it in main and ensure finally always executes.

5.5

Built-in and User Defined Exceptions in Java

Lecture2 assignments

Assignment 1

Built-in Exceptions Practice

Assignment BriefDue: Complete as a consolidation of Unit 5

Built-in Exceptions Practice

Write a Java class that demonstrates and handles four built-in exceptions: ArithmeticException, NumberFormatException, ArrayIndexOutOfBoundsException, and NullPointerException. Use separate methods for each case.

Assignment 2

User Defined Exception Practice

Assignment BriefDue: Complete as a consolidation of Unit 5

User Defined Exception Practice

Create a custom exception class (for example InvalidAgeException or InvalidMarksException). Use it in a Java program to validate user input, throw the exception when validation fails, and handle it with a meaningful message.