what is difference between throw and throws in exception?
Answer Posted / ritesh
Throw :- It is possible for your program to throw an
exception explicitly, using the throw statement.
Throws :- If a method is capable of causing an exception
that it does not handle, it must specify this behavior so
that callers of the method can guard themselves against that
exception.
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is string array?
What is a parameter in simple terms?
What are the differences between processes and threads?
What is finally and finalize in java?
What is a finally block? Is there a case when finally will not execute?
What is passing by reference in java?
What is the purpose of a parameter?
What is sortedset in java?
What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?
What is java used for?
Explain the difference between treeset and treemap in java?
What is port number in java?
Can a static class have a constructor?
How many types of constructors are used in java?
Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?