11.19 (Constructor Failure) Write a program that shows a constructor passing information about constructor failure to an exception handler. Define class SomeClass, which throws an Exception in the constructor. Your program should try to create an object of type SomeClass and catch the exception that’s thrown from the constructor

Respuesta :

Answer:

You absolutely should throw an exception from a constructor if you're unable to create a valid object. This allows you to provide proper invariants in your class. ... Throw an exception if you're unable to initialize the object in the constructor, one example are illegal arguments.

Explanation:

ACCESS MORE