it shows error....The divideByZero method must contain a divide-by-zero operation...i have tried a lot with different possibilities but helpless....
package com.codegym.task.task09.task0919;
/*
Dividing by zero
*/
public class Solution {
public static void main(String[] args) {
try {
divideByZero();
}
catch(ArithmeticException e) {
e.printStackTrace();
}
}
public static void divideByZero() throws ArithmeticException {
int a = 10;
int b = 0;
int c = a/b;
System.out.println(c);
}
public static void printStackTrace(Throwable throwable) {
for(StackTraceElement element : throwable.getStackTrace()) {
System.out.println(element);
}
}
}