What is the difference between throw & throws? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the difference between throw & throws?

little confused, help me out!!!

26th Apr 2017, 4:47 PM
elsa
elsa - avatar
3 Answers
+ 4
26th Apr 2017, 5:13 PM
Burey
Burey - avatar
+ 1
throw statement used for throwing an exception from try to catch block throws is used to specify that a class used will generate a certain types of exception under certain circumstances.
26th Apr 2017, 4:55 PM
Nantha
Nantha - avatar
+ 1
Throw is the action and throws is letting everyone know you can throw any type of exception so they basically come together sometimes. It's recommended learning those kind of things as fast as possible because it can a lot of your time. Errors does takes time to be detected and learning can save it. If you find it too troubling for you, you can try any program to help. I tend to use checkmarx, but it's also important to learn it by yourself. Anyway, good luck! Ben.
26th Apr 2017, 10:47 PM
Ben hart