This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
You do not need a member variable to store the message in your own exception class, because the superclass Exception already has such a member variable. Write your own exception class by implementing four constructors, like this:
Those four constructors correspond to the constructors of the base class Exception.
And then use it like this:
Use the standard getMessage() method from class Exception to see the message: