Try Catch()

Try Catch() related Interview question ask .


1. Can Multiple Catch block execute ?

No


2. Can multiple catch block can you write ?

Yes 


3. Does finally block get execute whether exception throw or not ?

Not


4. What is difference between throw and throw ex ?

throw :

"throw" statement, it preserve original error stack information. In exception handling "throw" with empty parameter is also called re-throwing the last exception.


"throw ex"   doesn't - the original offender would be preserved i.e not showing original or accurate error .


So it is good practice to use the "throw" statement, rather than "throw ex" because it will give us more accurate stack information rather than "throw ex".