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 throw and throws 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 "throw and throws" Watch "throw and throws" New topic
Author

throw and throws

Mark Henryson
Ranch Hand

Joined: Jul 11, 2005
Posts: 200
Hi,

What are the differemces between throw and throws in Exception handling. Please explain with some example coding will be very useful.

I am learning in the Head First Java. In that book they mentioned DUCK IT. Anybody if uses the same book and know it please explain it.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

throw: throw a specific exception from some point in the code.
throws: flag that a method may throw a named exception. So:

[ August 22, 2005: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: throw and throws
 
Similar Threads
throws vs throw
Exceptions
Exception handling throw and throws
exam watch question
AssertionError