Ishu_15hu

Exception Handling C#

Dec 1st, 2020
441
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.                    
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         try{
  8.             int a=10, b = 0;
  9.             int c = a/b;
  10.             Console.WriteLine("c = "+ c);
  11.         }
  12.         catch {
  13.             Console.WriteLine("There is an divide by zero exeption, so it has been thrown here Catch block");
  14.         }
  15.         finally{
  16.             Console.WriteLine("Finally block always will be executed");
  17.         }
  18.     }
  19. }
RAW Paste Data