using System;
class MainClass
{
public static void Main()
{
try
{
int zero = 0;
Console.WriteLine("In try block: attempting division by zero");
int myInt = 1 / zero;
Console.WriteLine("You never see this message!");
}
catch
{
Console.WriteLine("In catch block: an exception was thrown");
}
finally
{
Console.WriteLine("In finally block: do any cleaning up here");
}
}
}
|