Error Handling in try catch statement, try { b=0; c=a/b; } catch (Exception ex) {} catch // related exception{} finally{} which exception will catch first statement? try { int b = 0; int c = 10 / b; } catch (Exception e) { } catch(DivideByZeroException ae) { } finally { } Ans:- Numerous catch blocks are evaluated from top to bottom for each exception that is thrown, but only one catch block is actually executed. The order in which the catch blocks are inserted is important because.NET will jump to the first catch block that is polymorphically consistent with the thrown exception. Catch blocks for exception classes that are the most specialized and descending should come first. In your example, the exception's type—which acts as the starting point for all exceptions and is, therefore, polymorphically consistent with every...
"The Versatile Geek" delivers a blend of educational and entertaining content, whether you're an experienced computer enthusiast or just someone who likes the geeky side of life. Join us on this adventure as we embrace our love of everything geeky and build a community that enjoys the wonders of modern technology, entertainment, and culture.