Computer Science, asked by shivani148, 1 year ago

difference between throw and throws

Answers

Answered by John976
1
1) In simple words throw is used to throw an exception & throws is used to declare an exception.
2) throw is used in method implementation& throws is used in method signature.
3) using throw keyword we can throw only1 exception at a time & throws can declaremultiple exception at a time.
Thank You
Answered by Disha234
1
throw explicitly throws an exception and it is used in method implementation
but throws is used with a method to throw multiple exceptions and it is used in function signature
Similar questions