Catch OverflowException Exception : int : Data Types C# Source Code


Custom Search

C# Source Code » Data Types » int »

 

Catch OverflowException Exception








    




using System;
   
class MainClass
{
    public static void Main()
    {
        try
        {
            checked
            {
                int Integer1;
                int Integer2;
                int Sum;
   
                Integer1 = 9999999999;
                Integer2 = 2000000000;
                Sum = Integer1 + Integer2;
            }
        }
        catch(OverflowException)
        {
            Console.WriteLine("A mathematical operation caused an overflow.");
        }
    }
}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Data Types
» int