7/15/2010

C# Exception Handling (Exception)



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ExceptionHandling
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                int a = int.Parse(args[0]);
                int b = int.Parse(args[1]);
                Console.WriteLine("Result: " + (a / b));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            
        }
    }
}

No comments:

Post a Comment