Assume that processor refers to an object that provides a void method named process that takes no arguments. As it happens, the process method may throw one of several exceptions. Write some code that invokes the process method provided by the object associated with processor and arrange matters so that if process throws any exception, your code prints the message "process failure" to standard output and does nothing else in regard to the exception. Hint: use the catch (Exception ex) for the catch clause.

Respuesta :

Limosa

Answer:

Following are the code written in the C# Programming Language:

/*.......exception handling......*/

try{ //if the program is correct

processor.process() //calling of the function

}

catch (Exception ex){ //if the program incorrect

Console.WriteLine("process failure")  //print message

}

Explanation:

Here, the following code we use exception handling in C# Programming Language in which we use the following try and catch block.

  • Firstly, we use the try block if the is correct then, we call the following method through the object.
  • Then, we use the catch block if the program is incorrect then, we print the following message.
ACCESS MORE