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 initial size of arraylist in java?
Can we increase size of array?
How do you break a loop?
What is object in java?
What are the 3 types of loops in java?
Can a constructor be private and how are this() and super() method used with constructor?
How do you trim a space in java?
What does string mean in java?
Can we use this () and super () in a method?
What are the different tags provided in jstl?
What is an abstract method in java programming?
Can you explain the final method modifier?
what are synchronized methods and synchronized statements? : Java thread
What do you mean by Function Overloading in java?
What does || || mean in math?