what difference between throw and throws in exception
handling.
Answer Posted / aravinda reddy
Whenever we want to force an exception then we use throw
keyword,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. throw we will use at statement
level.
Whereas when we know that a particular exception may be
thrown or to pass a possible exception then we use throws
keyword. Point to note here is that the Java compiler very
well knows about the exceptions thrown by some methods so
it insists us to handle them. Method Level
Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is a protected void?
What is the default value of local and global variables?
What is the collections api in java programming?
what is the use of pojo (plain old java objects)? how it is interact with crystal reports? pls urgent
What is api data?
What is void keyword?
What is the private method modifier?
What is stream api in java8?
Name few "optional" classes introduced with java 8 ?
What is singleton class in java and how can we make a class singleton?
How can we pass argument to a function by reference instead of pass by value?
What is flag in python?
Which java ide is used the most?
What is the this keyword?
How to make a non daemon thread as daemon?