调用静态方法,使用throws语句进行异常处理

在测试类中编写一个实现除法功能的静态方法,然后调用该方法,对可能出现的异常使用throws语句抛出

示例代码如下:

public class Test {

    public static void main(String[] args) throws ArithmeticException {
        try {
            Test.divide(1, 0);
        } catch (ArithmeticException e) {
            throw e;
        }

    }

    private static int divide(int dividend, int divisor) {
        return dividend / divisor;

    }
}

如有帮助,请采纳。

太简单了 不予回答