try { int n1,n2; n1=Convert.ToInt32(args[0]); n2=Convert.ToInt32(args[1]); int res; res=n1/n2; Console.WriteLine("res:"+res); } catch(Exception e) { Console.WriteLine(e.Message); } catch(FormatException e) { Console.WriteLine("Format Exception-"+e.Message); } If command line arguments are given as 12 r what is the output?

 Posted by deccansoft on 8/4/2010 | Category: C# Interview questions | Views: 3301

An Error occurs telling " A Previous catch clause already catches all exceptions" so catch block of FormatExeption should be placed first follwed by Super class Exception handler.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response