Java OCA OCP Practice Question 1349

Question

Fill in the blanks:

The ___ keyword is used in method declarations, while the ___ keyword is used to throw an exception to the surrounding process.

  • A. throws, throw
  • B. catch, throw
  • C. throw, throws
  • D. throws, catch


A.

Note

The throws keyword is used in method declarations, while the throw keyword is used to throw an exception to the surrounding process.

Option A is the correct answer.

The catch keyword is used to handle exceptions, not to create them or in the declaration of a method.




PreviousNext

Related