Question: JAVA questions: If the code in a method can potentially throw a checked exception, then that method must: a.)handle the exception b.)have a throws clause

JAVA questions:

If the code in a method can potentially throw a checked exception, then that method must:

a.)handle the exception

b.)have a throws clause listed in the method header

c.)neither handle the exception nor have a throws clause listed in the method header

d.)either handle the exception or have a throws clause listed in the method header

Given the following constructor code, which of the statements are TRUE?

JAVA questions: If the code in a method can potentially throw a

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.)The calling method must handle the exceptions thrown in the constructor, or have its own throws clause specifying them
d.)All of these

public Book (String ISENOfBook, double priceofBook, int numberorderedOfBook) if '' (ISBNOfBook '') == throw new BlankISBN) if (priceofBook

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!