12345678910



Question 1: Which of the following is a correct outline of a method that throws an exception when it finds a problem?
1. public void someMethod ()
{
...
if ( problem )
throw new Exception("Useful Message");
...
}
2. public void someMethod () throws Exception
{
...
if ( problem )
Exception("Useful Message");
...
}
3. public void someMethod () throws Exception
{
...
if ( problem )
throw( new Exception("Useful Message") );
...
}
4. public void someMethod () throws Exception
{
...
if ( problem )
throw new Exception("Useful Message");
...
}