1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

throw and throws

Discussion in 'Java' started by prashantSum, Oct 26, 2005.

  1. prashantSum

    prashantSum New Member

    Joined:
    Oct 24, 2005
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    0
    what is the difference between throw and throws
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,285
    Likes Received:
    364
    Trophy Points:
    83
    throw
    keyword that allows the user to throw an exception or any class that implements the "throwable" interface.

    throws
    keyword used in method declarations that specify which exceptions are not handled within the method but rather passed to the next higher level of the program.

    I hope it clears the doubt in your mind.
     

Share This Page