Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference B/w Throw and throws

 
kethare eswaran
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wat is the difference between the Keywords "THROW" and "THROWS"

Is the THROWS doesnot have any per defined methods as throw

Can u Expline working of THROWS in the Try catch block kethare@sify.com
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch!

The keyword throws is a declaration "warning" that the associated method or class might throw the indicated exception(s). The keyword throw is used to actually throw something. For example...

In general, if an exception is caught, then it is considered handled and does not need to be declared with the keyword throws. For example...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic