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
Write a program to print fibonacci series
What is the relationship between class and object?
What are the different conditional statements?
What is passed by reference and pass by value ?
What happens when you add a double value to a string?
Differentiate between nested and inner class in java.
What is the java project architecture?
What does singleton class mean?
What is null object in java?
What is the replace tool?
How do you differentiate abstract class from interface?
What is unmodifiable collection in java?
What is entry set in java?
Is it compulsory for a try block to be followed by a catch block in java for exception handling?
Which class is used by server applications to obtain a port and listen for client requests?