wood burning stoves*
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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
 
 
subject: throw and throws