Assume that the classes BlankISBN, NegativePrice, and NegativeNumberOrdered are exception classes that inherit from Exception. The following code is a constructor for the Book class. What must be TRUE about any method that instantiates the Book class with this constructor?
Public Book(String ISBNOfBook, double priceOfBook,
Int numberOrderedOfBook) throws BlankISBN,
NegativePrice,
NegativeNumberOrdered
{
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) It must call the constructor with valid data or a compiler error will occur.
B) It must contain an inner class that extends the IOException class.
C) It must handle all of the possible exceptions thrown by the constructor or have its own throws clause specifying them.
D) All of the above
Correct Answer:
Verified
Q21: In order for an object to be
Q22: If, within one try statement you want
Q23: To serialize an object and write it
Q24: When you write a method that throws
Q25: Under Windows, which of the following statements
Q27: If a method does not handle a
Q28: This is a section of code that
Q29: Unchecked exceptions are those that inherit from:
A)
Q30: Look at the following code: FileInputStream fstream
Q31: When writing a string to a binary
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