JAVA-运算符


public class variable_test04 {
    public static void main(String[] args) {
        int a=6;
        int b=4;

        System.out.println(a*b);//24
        System.out.println(a/b);//1.5

        System.out.println(a+b);//10
        System.out.println(a-b);//2
        System.out.println(a%b);//2

        //整数相除只能得到整数,要想得到小数,必须有浮点数的参与

        System.out.println(6.0/4);//2

    }
}

posted @ 2022-07-28 19:56  NiceTwocu  阅读(14)  评论(0编辑  收藏  举报