This discussion is archived
1 Reply Latest reply: Jun 27, 2012 9:23 PM by rp0428 RSS

What is the Use of throws in Exception Handling

944770 Newbie
Currently Being Moderated
I have clear idea about try,catch,finally, but i do not have clear idea about throws

Can u anyone explain about throws with example program?

Thanks
  • 1. Re: What is the Use of throws in Exception Handling
    rp0428 Guru
    Currently Being Moderated
    >
    I have clear idea about try,catch,finally, but i do not have clear idea about throws

    Can u anyone explain about throws with example program?
    >
    Yes - the Java Tutorial can explain it and has examples
    http://docs.oracle.com/javase/tutorial/essential/exceptions/

    And all of the Java Language constructs, including 'throws' are defined in the Java Language Specification
    http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4.6
    >
    8.4.6. Method Throws
    A throws clause is used to declare any checked exception classes (§11.1.1) that the statements in a method or constructor body can throw (§11.2.2).

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points