what is difference between throw and throws in exception?
Answer Posted / ajay
Throws keyword suggests that the particular method contains
an Exception and that uncaught Exception is thrown to be
next class where it is supposed to handle(i.e.to be by next
user as he want to handle that exception in his own
way).Simply it throws uncaught exception.But Throws keyword
is used to throw only checked Exceptions and avoids compile
time errors.
And throw keyword,which is used in case of manual
Exception,throw object of corresponding exception from try
to catch just like java implicitely does in cases other than
manual Exception.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is difference between next () and nextline () in java?
What is static in java?
Why chararray() is preferred over string to store the password?
What is function and its uses?
What is default exception handling in java?
What is the difference between == and === javascript?
What are three ways in which a thread can enter the waiting state in java programming?
What is finalize method?
What are decalarations?
What is class array in java?
What is numeric data type?
What is rmi and steps involved in developing an rmi object?
What are the supported platforms by java programming language?
What does the “static” keyword mean? Can you override private or static method in java?
What is the main function in java?