Imports System
Public Class MainClass
Shared Sub Main(ByVal args As String())
Try
ThrowExceptionWithoutCatch()
Catch
Console.WriteLine("Caught exception from " & _
"ThrowExceptionWithoutCatch in Main")
End Try
End Sub
Shared Public Sub ThrowExceptionWithoutCatch()
Try
Console.WriteLine("In ThrowExceptionWithoutCatch")
Throw New Exception( _
"Exception in ThrowExceptionWithoutCatch")
Finally
Console.WriteLine("Finally executed in " & _
"ThrowExceptionWithoutCatch")
End Try
' unreachable code; logic error
Console.WriteLine("End")
End Sub
End Class
|