Question:You are creating a custom exception class named ProductDoesNotExistException so that
custom exception
messages are displayed in a new application when the product specified by users is unavailable.
This custom exception class will take the ProductID as an argument to its constructor and expose this
value through the ProductID.
You are now in the process of creating a method named UpdateProduct.
This method will be used to generate and manage the ProductDoesNotExistException exception if the
ProductID variable contains the value 0.
You need to ensure that use the appropriate code for the UpdateProduct method.
What should you do? -(VB-.Net) 

A Make use of the following code:
Public Sub UpdateProduct()
Try
If ProductID = 0 Then
Throw New ProductDoesNotExistException(ProductID)
End If
Catch ex As ProductDoesNotExistException
MessageBox.Show("There is no Product" + ex.ProductID)
End Try
End Sub 

B Make use of the following code: .
Public Sub UpdateProduct()
Try
If ProductID = 0 Then
Throw New Exception("Invalid ProductID")
End If
Catch ex As ProductDoesNotExistException
MessageBox.Show(ex.Message)
End Try
End Sub 

C Make use of the following code:
Public Sub UpdateProduct()
If ProductID = 0 Then
Throw New ProductDoesNotExistException(ProductID)
End If
End Sub 

D Make use of the following code:
Public Sub UpdateProduct()
If ProductID = 0 Then
Throw New Exception("Invalid ProductID")
End If
End Sub 

+ Answer
+ Report
Total Preview: 1215

Copyright © 2024. Powered by Intellect Software Ltd