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?

Respuesta :

Answer:

<--Continuity of question-->

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;

}

<--Options-->

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

Explanation:

the correct option is

C) It must handle all of the possible exceptions thrown by the constructor or have its own throws clause specifying them.

ACCESS MORE