一、+
1、用于算数计算
2、用于字符串连接
//+
int a = 2;
int b = 3;
int c = a+b;
double d = 1.23;
double e = 2.22;
double f = d+e;
double g = f+c;
//字符串的+是连接
String h = "g:"+g;
System.out.println("c = [" + c + "]");
System.out.println("g = [" + g + "]");
System.out.println("h = [" + h + "]");
二、-
用于算数运算
int a = 2;
int b = 3;
int c = b-a;
double d = 1.23D;
double e = 2.22D;
double f = e-d;
double g = f-c;
三、*
用于算数运算
int a = 2;
int b = 3;
int c = b*a;
double d = 1.23D;
double e = 2.22D;
double f = e*d;
double g = f*c;
四、/
用于算数运算
int a = 2;
int b = 3;
int c = b/a;
double d = 1.23D;
double e = 2.22D;
double f = e/d;
double g = f/c;
五、%
取余,用于算数运算
int a = 2;
int b = 3;
int c = b%a;
double d = 1.23D;
double e = 2.22D;
double f = e%d;
double g = f%c;
五、++、--
用于自增、自减
//自增
double h = 2.33;
System.out.println("h1 = [" + (h++) + "]");//使用后自增
System.out.println("h2 = [" + h + "]");
//自增
System.out.println("h3 = [" + (++h) + "]");//使用前自增
System.out.println("h4 = [" + h + "]");
/*
h1 = [2.33]
h2 = [3.33]
h3 = [4.33]
h4 = [4.33]
*/
//自减
int i = 3;
System.out.println("i1 = [" + (i--) + "]");//使用后自增
System.out.println("i2 = [" + i + "]");
//自减
System.out.println("i3 = [" + (--i) + "]");//使用前自增
System.out.println("i4 = [" + i + "]");
/*
i1 = [3]
i2 = [2]
i3 = [1]
i4 = [1]
*/