This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Difference between Throws and Throw Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference between Throws and Throw" Watch "Difference between Throws and Throw" New topic
Author

Difference between Throws and Throw

satya sahu
Ranch Hand

Joined: Mar 26, 2003
Posts: 97
Hi all, can somebody tell me the difference between throws and throw with some good example.
Thanks in advance.

satya
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

"throws": used to announce a method may throw an exception, so you need to handle it in code that uses the method.
"throw": actually throws an exception.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
throws say it might throw sometime in the future
throw does the throwing NOW

Brian


My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between Throws and Throw
 
Similar Threads
Difference
throw and throws
throws and throw
throw and throws
Throws and throw