Quiz question: What is the output of running the following program:
Sub Main()
Try
CallToMethodThatThrowsException()
Catch ex As ArgumentException
Console.WriteLine("Argument exception caught")
Finally
Console.WriteLine("Outer finally block")
End Try
End开发者_运维技巧 Sub
Public Sub CallToMethodThatThrowsException()
Try
ThrowExceptionMethod()
Finally
Console.WriteLine("Inner finally block")
End Try
End Sub
Public Sub ThrowExceptionMethod()
Throw New ArgumentException()
End Sub
No code writing please :) - the first to answer correctly gets the big prize (an accepted answer :) )
I'd assume:
inner finally block
argument exception caught
outer finally block
"Inner finally block"
"Argument exception caught"
"Outer finally block"
精彩评论