Ask Question
11 November, 00:17

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?

+2
Answers (1)
  1. 11 November, 01:27
    0
    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

    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.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Assume that the classes BlankISBN, NegativePrice, and NegativeNumberOrdered are exception classes that inherit from Exception. The ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers