what is difference between throw and throws in exception?
Answer Posted / arun
throw is used to throw an exception manually when we feel
that particular line of code in our program is going to
throw an exception
throw new MyException("exception")
throws is used instead of try and catch block,if we are not
using try and catch block and we know that our program is
going to throw an exception than we use throws key word
public void myExecption() throws Exception
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the difference between member variables initialization and assignment in a constructor?
Explain inheritance in java?
What is the meaning of I ++ in java?
What is flush () in java?
What is thread count in java?
what is enumset?
What java is used for?
Will the jvm load the package twice at runtime?
What is the difference between processes and threads?
What is encapsulation in java?
What is a static class in java?
How hashset works internally in java?
Explain creating threads by implementing runnable class?
define the terminology association.
What is the difference between an interface and an abstract class?