问答详情
源自:3-3 Java中的赋值运算符

为什么不行呀大神看看哪里错误了

public class jishuangqi{
    public static void main(String[] args) {
     int one = 10 ;
        int two = 20 ;
        int three = 0 ;
        int a=one+two;
        int b=one+a;
        int c=b-two;
        int d=a*one;
        int e=d/one;
        int f=e/three;
        System.out.println("three=one+two==>"+a);
        System.out.println("three+=one ==>"+b);
        System.out.println("three-=one==>"+c);
        System.out.println("three*=one==>"+d);
        System.out.println("three/=one==>"+e);
        System.out.println("three%=one==>"+f);
     
   
 }
}

提问者:慕勒0327833 2020-03-05 22:50

个回答

  • 隔壁老王来咯
    2020-03-06 09:42:35

    Java中整数除以0会抛出异常,算术运算异常ArithmeticException,你的f就是整数除以0了