what is difference between throw and throws in exception?
Answer Posted / gourav shivhare
The throw keyword denotes a statement that causes an exception to be initiated. It takes the Exception object to be thrown as an argument. The exception will be caught by an enclosing try-catch block or propagated further up the calling hierarchy. The throws keyword is a modifier of a method that denotes that an exception may be thrown by the method. An exception can be rethrown.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Can we execute java program without main method?
How many types of array are there?
Explain the difference between string, stringbuffer and stringbuilder in java?
Which method cannot be overridden in java?
how to handle exceptions in ejb?
4.1 Supply contracts (in the form of comments specifying pre- and post conditions) for the enqueue() method of the LinkedQueue class given in the Appendix. (2) 4.2 Let Thing be a class which is capable of cloning objects, and consider the code fragment: Thing thing1 = new Thing(); //(1) Thing thing2 = thing1; //(2) Thing thing3 = (Thing) thing1.clone(); //(3) Explain how the objects thing2 and thing3 differ from each other after execution of the statements. (
What is the functionability stubs and skeletons?
What is a pointer and does java support pointers?
Why main() method is public, static and void in java ?
Can we access instance variables within static methods ?
What is hashing in java?
Can we make constructors static?
Why is stringbuffer thread safe?
What is a boolean output?
What is java argument list?