• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

throw and throws

 
Mark Henryson
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic