CS 221
Advanced Programming

Wednesday, February 11, 2009

Robust Programs and Exception Handling

You can find the slides for today's lecture here.

Below is the small snippet of code we used to demonstrate how the Finally block works

package exceptionExample;

public class Main {
	public static void main (String  [] args)
	{
		try
		{
			int i = Integer.parseInt("1");
		}
		catch (NumberFormatException ex)
		{
			System.out.println(ex.toString());
		}
		finally
		{
			System.out.println("In the finally block");
		}
	
	}
}