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
Explain java coding standards for variables ?
Why do we need data serialization?
What is a variable simple definition?
What is passing value java?
What are the two types of streams offered by java 8?
What does a za z0 9 mean?
What is anti pattern in cyber security?
Tell me the latest versions in java related areas?
Can static methods access instance variables in java?
What is functional interface in javatpoint?
Is void a data type?
What is the disadvantage of synchronization?
Where is const variable stored?
What is the synonym of string?
Can we declare a constructor as final?