A developer creates a custom exception as shown below:
public class ParityException extends Exception { }
What are two ways the developer can fire the exception in Apex?
throw new ParityException ();
throw new parityException ('parity does not match');
new ParityException ();
new ParityException('parity does not match');
Throwing Exceptions in Apex:
throw new ExceptionType();creates a new instance and throws it.
A: No argument constructor.
B: Constructor with a custom error message.
Why Not Other Options?
C and D: These create exception instances but do not throw them, which is not valid syntax for firing an exception.
Submit