Assume That the Classes BlankISBN,NegativePrice,and NegativeNumberOrdered Are Exception Classes That
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
Q7: The call stack is an internal list
Q22: If, within one try statement you want
Q23: To serialize an object and write it
Q24: When you write a method that throws
Q30: The catch clause
A) follows the try clause.
B)
Q32: If the program does not handle an
Q36: When an exception is thrown by code
Q52: A class must implement the Serializable interface
Q53: If a random access file contains a
Q54: The throw statement informs the compiler that
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