package com.xu.operator;
import com.xu.base.*;
public class Demo01 {
public static void main(String[] args) {
//二元运算符
//ctrl+d:复制当前行到下一行
int a=10;
int b=20;
int c=25;
int d=25;
System.out.println(a+b);
System.out.println(a-b);
System.out.println(a*b);
System.out.println(a/b);//0
/*
a和b均为int型,0.5取整数部分0;要算的话需要把他们强制
转换下,因为他们都有可能产生小数,转一个为double;所以在
除以数值时,一定要注意作用范围;
*/
System.out.println(a/(double)b);//0.5
}
}
\Desktop\JavaSE\out\production\基础语法" com.xu.operator.Demo01
30
-10
200
0
0.5
Process finished with exit code 0