...
Code Block | ||
---|---|---|
| ||
public class DivideException { public static void main(String[] args) { try { division(200,5); division(200,0); //divide by zero } catch (Exception e) { System.out.println("Divide by zero exception : " + e.getMessage()); } } public static void division(int totalSum, int totalNumber) throws ArithmeticException, IOException { int average = totalSum/totalNumber; System.out.println("Average: "+ average); } } |
Noncompliant Code Example
...