OverflowException Exception : Buildin Exceptions « Development Class « C# / C Sharp
- C# / C Sharp
- Development Class
- Buildin Exceptions
OverflowException Exception
using System;
class MainClass {
public static void Main() {
try {
checked {
int Integer1;
int Integer2;
int Sum;
Integer1 = 2000000000;
Integer2 = 2000000000;
Sum = Integer1 + Integer2;
}
} catch(OverflowException) {
Console.WriteLine("A mathematical operation caused an overflow.");
}
}
}
Related examples in the same category