SPIRO THE TECH GURU

Back

Difference between throw and throws in java

By Admin on

  • throw keyword used to throw user defined exceptions.(we can throw predefined exception too)
  • If we are having our own validations in our code we can use this throw keyword.
  • For Ex: BookNotFoundException, InvalidAgeException (user defined) 
SPIRO Google Plus