Throwing Java exceptions

Throwing Java exceptions is similar to throwing C++ exceptions.

To throw a new exception, use the syntax in either of the first two lines:

throw new_A_B_MyException("MyMessage");
throw new_A_B_MyException();

// Invalid because of space between "new" 
// and A_B_MyException
throw new A_B_MyException(); 

To throw an existing exception object:

A_B_MyException ex = mc.getMyException();
throw ex;