05-29-2018, 08:44 AM | #1 |
Registered User
Join Date: Mar 2018
Posts: 341
|
What is difference between throw and throws?
throw keyword throws keyword
1)throw is used to explicitly throw an exception. throws is used to declare an exception. 2)checked exceptions can not be propagated with throw only. checked exception can be propagated with throws. 3)throw is followed by an instance. throws is followed by class. 4)throw is used within the method. throws is used with the method signature. 5)You cannot throw multiple exception You can declare multiple exception e.g. public void method()throws IOException,SQLException.
__________________
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|