Throws Clause

Reply

Join Date: Oct 2004
Posts: 2
Reputation: salmanrauf is an unknown quantity at this point 
Solved Threads: 0
salmanrauf salmanrauf is offline Offline
Newbie Poster

Throws Clause

 
0
  #1
Oct 12th, 2004
What is meant by the throws clause?Where & how is it used?
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 185
Reputation: Stack Overflow is an unknown quantity at this point 
Solved Threads: 4
Stack Overflow's Avatar
Stack Overflow Stack Overflow is offline Offline
C Programmer

Re: Throws Clause

 
0
  #2
Oct 12th, 2004
Greetings,

In Java, all methods use the throw statement to throw an exception. The throw statement requires a single argument: a throwable object. In the Java system, throwable objects are instances of any subclass of the Throwable class.

If you attempt to throw an object that is not throwable, the compiler refuses to compile your program and displays an error message.

The throws clause specifies that the method can throw an EmptyStackException. As you know, the Java language requires that methods either catch or specify all checked exceptions that can be thrown within the scope of that method.


- Stack Overflow
Following the rules will ensure you get a prompt answer to your question. If posting code, please include BB [code][/code] tags. Your question may have been asked before, try the search facility.

IRC
Channel: irc.daniweb.com
Room: #c, #shell
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC