Which of the following keywords is used to manually throw an exception in Java?

  • catch
  • throw
  • throws
  • try
In Java, the throw keyword is used to manually throw an exception. It allows you to create custom exceptions or raise predefined exceptions when certain conditions are met. This is a fundamental part of Java's exception handling mechanism.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *