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

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.

Paul Sturrock

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


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