This code will compile successfully (as part of a method):
 
try 
{ 
     Console.WriteLine("TRY"); 
     throw new Exception("EXCEPTION"); 
} 
catch (Exception) 
{ 
      Console.WriteLine("CATCH"); 
}
 
Explanation
It is not necessary to indicate the identifier of exception in the catch block.
C#
C# Quiz
Learn C# Online

or Read more about C# Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback