program
to demonstrate the concept of exception handling
-----------------------------------------code---------------------------------------------------------
-----------------------------------------output----------------------------------------------------
-----------------------------------------code---------------------------------------------------------
Imports System
Module module1
Sub main()
Dim x As Integer = 0
Dim div
As Integer
Try
div = 100 / x
Console.WriteLine("Exception not occured")
Catch
ex As DivideByZeroException
Console.WriteLine("Exception occured")
Finally
Console.WriteLine("Finally blocked")
End Try
Console.WriteLine("Result is {0}", div)
Console.ReadKey()
End Sub
End Module-----------------------------------------output----------------------------------------------------
codestrew |
No comments:
Post a Comment