Given the following constructor code, which of the statements are true? public Book(String ISBNOfBook, double priceOfBook,
Int numberOrderedOfBook)
{
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) There is an error: a throws clause should be added to the constructor header.
B) Classes extending the Exception class should be created for each of the custom exceptions that are thrown in the constructor.
C) A FileNotFoundException will be thrThe calling method must handle the exceptions thrown in the constructor, or have its own throws clause specifying them.
D) All of these are true.
Correct Answer:
Verified
Q47: When an exception is thrown by code
Q48: What will be the result of the
Q49: In a catch statement, what does the
Q50: Assume that the classes BlankISBN, NegativePrice, and
Q51: What will be the result of the
Q53: If you want to append data to
Q54: If the data.dat file does not exist,
Q55: In Windows, which of the following statements
Q56: In the following code, assume that inputFile
Q57: The RandomAccessFile class treats a file as
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