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
Is object a data type?
What is Session reduplication and how its done?
When is the finalize() called?
How do you add an arraylist to an array in java?
How to run a JAR file through command prompt?
How can you avoid serialization in child class if the base class is implementing the serializable interface?
Is it correct to say that due to garbage collection feature in java, a java program never goes out of memory?
What are mutable classes?
Explain the private protected method modifier?
What is argument in java?
Does java allow overriding static methods ?
What’s the difference between unit, integration and functional testing?
What are the drawbacks of singleton class?
What is scope of a variable?
Is a copy constructor?