Computer Science, asked by ashwanimaurya, 1 year ago

what is difference between try and catch block?

Answers

Answered by elaaaa88888888
1
A try-catch block is an exception handling technique. While a try clause is a precursor to a block, the catch word forms part of a statement.

If you expect a code to throw exceptions, you'd prefer writing the error-prone code inside a try block and expect the associated exception to ‘catch’ it with the catch statement. Something like this snippet:

ashwanimaurya: thanks where did you live
elaaaa88888888: khalilabad
ashwanimaurya: nice are you on FB
ashwanimaurya: hai
elaaaa88888888: nooooo
ashwanimaurya: oops
ashwanimaurya: fine
elaaaa88888888: what
ashwanimaurya: nothing
elaaaa88888888: ok
Similar questions