what is difference between throw and throws in exception?
Answer Posted / ritesh
Whenever we want to force an exception then we use throw keyword.Moreover throw keyword can also be used to pass a custom message to the exception handling module i.e. the message which we want to be printed.
Whereas when we know that a particular exception may be thrown or to pass a possible exception then we use throws keyword
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is difference between class and object in java?
Which collection does not allow duplicates in java?
Can you extend singleton class?
What is arrays sort in java?
How do you add an element to an arraylist in java?
What are different data structures in java?
What are the benefits of operations in java?
Can inner class final?
What are loops in java? What are three types of loops?
What are invisible components?.
What is nextint java?
What is difference between path and classpath variables?
List the interfaces which extends collection interface?
What is anti pattern in java?
Can each java object keep track of all the threads that want to exclusively access it?