| | |
Throws Clause
![]() |
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
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
IRC
Channel: irc.daniweb.com
Room: #c, #shell
![]() |
Similar Threads
- question about throws(IOException) (Java)
- How to put throws IOException in tis code statement? help.. (Java)
- array index and returning (Java)
- Web Service / Packet Listener Smack Integration Error (JSP)
- exceptions (Java)
- exceptions (Java)
- Playing with RMI in Tiger (Java)
Other Threads in the Java Forum
- Previous Thread: Help with loops
- Next Thread: URGENT: Need help on I/O code!
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress input integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle physics plazmic print problem program programming project recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree trolltech unlimited utility webservices windows





