+ 1

what is difference between throw and throws ??

23rd Aug 2016, 5:49 PM
Shubham Burghate
Shubham Burghate - avatar
2 Respuestas
+ 1
throws keyword used to delegate or handle the checked exception which may arise by the compiler to the JVM. when programmer doesn't have any interest to handle the checked exception then he can write throws keyword which means giving control to the JVM itself to handle. where as throw keyword is used to create our own exception. Example: In case of Gmail login if we enter password incorrect then immediately it raises an exception/error saying invalid password. so internally developers will use throw keyword to raise that error/exception,if your entered password doesn't match.
24th Aug 2016, 3:24 AM
Sarath chalapaka
Sarath chalapaka - avatar
0
throw keyword will use when we want to create our own exception,throws will delegate the exception
24th Aug 2016, 11:21 AM
shridhar metraskar
shridhar metraskar - avatar