Which of the following rules is/are false for exceptions?

Options
- Each try block or "throw" must have at least one corresponding catch block
- Multiple catch blocks can be used to catch different classes of exceptions
- Both a and b
- Exceptions cannot be thrown (or re-thrown) in a catch block within a try block


CORRECT ANSWER : Exceptions cannot be thrown (or re-thrown) in a catch block within a try block

Discussion Board
php 5 has exception like other languages

PHP 5 has an exception model similar to that of other programming languages. An exception can be thrown, and caught ("catched") within PHP. Code may be surrounded in a try block, to facilitate the catching of potential exceptions. Each try must have at least one corresponding catch or finally block.

The thrown object must be an instance of the Exception class or a subclass of Exception. Trying to throw an object that is not will result in a PHP Fatal Error.

smzuber 08-19-2015 04:41 AM

WRONG!

Correct answer is wrong. From php.net, "Exceptions can be thrown (or re-thrown) within a catch block." http://php.net/manual/en/language.exceptions.php

matt php 06-10-2015 11:31 AM

Exceptions

Answer : Exceptions cannot be thrown (or re-thrown) in a catch block within a try block.



IamJay 02-9-2015 11:58 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement