在 Mac 中使用算术异常时 Java 运行时环境检测到一个致命错误

问题描述

在我的代码中,我试图在 eclipse java 中处理算术异常。我的代码在 Windows 中运行良好,但它在 Mac 中给出了一些致命错误,尽管它对于其他类型的异常(如 IndexOutOfBound)运行良好。我不知道是什么问题。所以下面是我的代码显示错误

public class ExceptionHandling {

public static void main(String[] args) {

    try{
         int num1=30,num2=0;
         int output=num1/num2;
         System.out.println ("Result: "+output);
      }
      catch(ArithmeticException e){
         System.out.println ("You Shouldn't divide a number by zero");
      }

   }

}

enter image description here

谢谢,这似乎是一个愚蠢的问题,但我会提前感谢您的帮助。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)