views:

443

answers:

3

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 :) )

+1  A: 

I'd assume:
inner finally block
argument exception caught
outer finally block

Pieter Nijs
A: 

Argument exception caught
Inner finally block
Outer finally block

shahkalpesh
+2  A: 

"Inner finally block"
"Argument exception caught"
"Outer finally block"

Ben