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 classes of exceptions may be caught by a catch clause in java programming?
How do you declare a destructor in java?
What is the primitive type byte?
What is the meaning of immutable regarding string?
How do you sort in descending order in java using collections sort?
How do you sort a string in alphabetical order in java?
What is a parameter used for?
What is argument in java?
What is jvm? How its run?
What are keywords give examples?
What is the main method java?
What is the do while loop syntax?
What does java stand for?
What is a generic code?
What do you mean by formatting?