What is the difference between throw and throws?
Answer Posted / manish kushwaha
First of all i would say both are reserved keyword in java
In Java Exception handling we are using above keyword throw
and throws.
Difference:
throws: throws clause is always use to propagate method
level exception, when ever you will use this clause, caller
method responsibility is to handle exception trowed by the
same method.
throw: this is the clause use to throw the instance of that
exception, main use of this throw clause is in user define
exception use you have written your own exception when ever
this exception will come you will throw this exception object.
Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
How many boolean functions are there?
What is array pointers ?
os is developed in c no java is more secured then c na why dont the os developed is developed using java
What is the difference between delete and delete[]
What is the type of lambda expression?
What checkbox method allows you to tell if a checkbox is checked?
What is the purpose of the main method?
Can we execute a program without main?
Is 64bit faster than 32 bit?
What’s a deadlock?
Hi.... I applied for the post of scientific officer/Engineer-SB(Programmer).Please post the syllabus and sample papers.
Can we clone singleton object?
What is the use of predicate in java 8?
Can private class be inherited in java?
What is append in java?