> why do we need a throw or clause when we have the
> catch blocks
> i m confused bt this concept can any body help me out
> .and differences between throw and throws
"throw" is like what idiots do in glass houses, only most thrown exceptions have a purpose.
Basically, "throw" means: something's gone wrong, crash my program unless somebody up the stack thought this might happen, catches it, and does something else.
"throws" is a tag for methods, to warn people up the stack to be prepared...
> why do we need a throw or clause when we have the
> catch blocks
> i m confused bt this concept can any body help me out
> .and differences between throw and throws
its simple if u want your own code to handle exceptions u try
and catch
them ...however if you want somebody else to do that (who so ever will be using that method) you can use throw
... that way you are not concealing any information ....see!!