0

Is try/cath similar to try/except?

Code in except is executed only if the exception in try occurs. Is it same with the try/catch block in Java?

21st Feb 2017, 10:41 PM
Nightwing
Nightwing - avatar
2 Answers
+ 2
Yup. both just get the exception that happened
21st Feb 2017, 11:09 PM
Jacob McKee
Jacob McKee - avatar
+ 2
Well, not exactly, as it is quite expensive to throw an exception in Java while it is at the basis of the language in Python, but other than that, the constructs are similar in form and features.
22nd Feb 2017, 12:45 AM
Amaras A
Amaras A - avatar