I have a question.
Would it be possible, hypthetically, in Java, to throw a running thread as exception? I know this is madness, but just for fun, could it be done? Something along the lines of:
public void throwThread() throws ExceptableThread {
ExceptableThread thread = new ExceptableThread();
thread.start();
throw thread;
Implementing Runnable as interface is not really an option. It should throw the actual thread object.
No, it wouldn't. Thread doesn't extend Throwable, so you can't throw it.
Even if it were possible, it would be a horrible conflation of two very separate responsibilities, IMO.
You can throw an exception with contains a Thread - weird things _
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With