Which of the following keywords is used by the calling function to guard against the exception that is thrown by called function?

Mỹ An

New member
Which of the following keywords is used by the calling function to guard against the exception that is thrown by called function?
A. try
B. throw
C. throws
D. catch
 
Answer: c
Explanation: If a method is capable of causing an exception that it does not handle. It must specify this behaviour so that callers of the method can guard themselves against that exception. This is done by using throws clause in methods declaration.
 

Tìm kiếm

Back
Top