what is difference between throw and throws in exception?
Answer Posted / ritesh
Whenever we want to force an exception then we use throw keyword.Moreover throw keyword can also be used to pass a custom message to the exception handling module i.e. the message which we want to be printed.
Whereas when we know that a particular exception may be thrown or to pass a possible exception then we use throws keyword
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Why is static used?
What is entry set in java?
What is string pooling concept?
How do you test a method for an exception using junit?
Is call by reference possible in java?
What is difference between call by value and call by reference?
How to sort elements in a parallel array in java?
Explain where variables are created in memory?
What is operator overloading. Is it is supported in java?
For ease of programming you can consider the maze as a 2D array with colors represented by below integer and characters (in capital letters). • B - Black • W -White • G- Green • R- Red R B W B W W W W W W B W B B W W W W W W W B W B W W W B W W W W B B W W W B W W W B W W B B B B W B W B W W B W W W B W W W B B B W W B W W W B W W B W B W W W B W B W W W W B B W W W W B W W W W W G Shortest Route Problem: • Solution that finds the shortest Route between Red and Green White will have 1 Weight. Red and Green carry no weights. Shortest path is the path with less weight when you add up the weights in the path.
What is a method type?
How many types of literals are there in JAVA?
Can we sort arraylist in java?
What is the purpose of using java.lang.class class?
Explain about arraylist?