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
Is empty list java?
What is queue in java?
What are the states of thread in java?
What makes a function well defined?
Explain wrapper classes in java?
how to open and edit XML file in Weblogic???
What do you mean by stream pipelining in java 8?
Name container classes in java programming?
How do you generate random numbers in java?
What are the six ways to use this keyword?
Can we create an object of static class in java?
What is a key in java?
What is better- service oriented or batch oriented solutions?
What are the types of literals?
What is passing parameters in java?