Given the following constructor code, which of the statements are TRUE?
Public Book(String ISBNOfBook, double priceOfBook,
Int numberOrderedOfBook)
{
If (ISBNOfBook == "")
Throw new BlankISBN() ;
If (priceOfBook < 0)
Throw new NegativePrice(priceOfBook) ;
If (numberedOrderedOfBook < 0)
Throw new NegativeNumberOrdered(numberOrderedv) ;
ISBN = ISBNOfBook;
Price = priceOfBook;
NumberedOrdered = numberOrderedOfBook;
}
A) There is an error: a throws clause should be added to the constructor header.
B) Classes extending the Exception class should be created for each of the custom exceptions that are thrown in the constructor.
C) The calling method must handle the exceptions thrown in the constructor, or have its own throws clause specifying them.
D) All of the above
Correct Answer:
Verified
Q3: To write data to a binary file
Q4: What is demonstrated by the following code?
Try
{
(try
Q5: If, within one try statement you want
Q6: All exceptions are instances of classes that
Q7: If your code does not handle and
Q9: If the code in a method can
Q10: A(n) _ is an object that is
Q11: To read data from a binary file
Q12: All of the exceptions that you will
Q13: The IllegalArgumentException class extends the RuntimeException class,
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents