Throw multiple exceptions at the same time. | Sololearn: Learn to code for FREE!


Throw multiple exceptions at the same time.

Is it possible to throw multiple exceptions at the same time in Java? maybe a work around the language features?

5/21/2018 11:18:39 AM


5 Answers

New Answer


Ulisses Cruz : I want to invoke a combination of different exception handlers at the same time... maybe it can be achieved by Events. 🤔🤔 yeah I can implement a similar behaviour using Events I think


Yes. You can throw an ARRAY out of Bounds exception, a .io* Exception, and others. Have done so. Such cluttered console! :)


I don't think it is possible. Why would you do that?


I advise you to use events so, throwing exceptions is expensive (slow) to be used with purpose. Exceptions should really be thrown, when something goes wrong (unexpected event or illegal state). I would say avoid exceptions where you can. Building some application mechanics which is controlled by (expects) throwables is not a good idea. First it may seem handy and fast, but it is quite the opposite.


processing exception runtime does something known as stack unwind, which may finish in Os, what known as program failure. you can re throw something on this way, but you can not enter this special mode twice