Solved

Assume That the Classes BlankISBN,NegativePrice,and NegativeNumberOrdered Are Exception Classes That

Question 34

Multiple Choice

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:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents