Professional Documents
Culture Documents
Using System
Using System
res = number1 / number2; Console.WriteLine (res); } static void Main(string[] args) { Add_Num.Adding_Numbers (10, 0); Console.ReadLine (); } } } Compilation error Throws DivideByZeroException No output Throws IOException
public class CountIsZeroException : ApplicationException { public CountIsZeroException(string message): base(message) { } } public class Calculate { int sum = 0; int count = 0; float average; public void DoAverage() { if (count == 0) throw (CountIsZeroException("Zero count in DoAverage")); else average = sum/count; } However, when Jennifer executed the preceding code snippet, an error was generated. Identify the bug in the preceding code snippet.
The CountIsZeroException class should extend the SytemException class. The Throw statement should be placed in the constructor of the CountIsZeroException class The Throw statement is missing the new keyword. The catch block is missing. Question ID : 1614 Viewed and Attempted Viewed but not Attempted Bookmarked and Attempted Bookmarked but not Attempted Not Viewed Not Attempted Click on a number to navigate