Java基本运算
2021-03-01 01:28
                         标签:==   关系   ade   ring   system   ++   str   使用   code    Java基本运算 标签:==   关系   ade   ring   system   ++   str   使用   code    原文地址:https://www.cnblogs.com/13roky/p/14453880.html
运算符
进阶运算
自增(++)自减(--)运算
public class Demo{
	
    public static void main(String[] args){
		
        //++   --  自增. 自减  一元运算符
        int a = 3;
        
        int b = a++;			//自增(++)在后面, 先赋值再自增运算
        
        System.out.println(a);	//输出结果为4
        System.out.println(b);	//输出结果为3
        
        int c = ++a;			//自增(++)在前面, 先自增运算再赋值
        
        System.out.println(a);	//输出结果为5
        System.out.println(c);	//输出结果为5
        
    }
}
数学运算(Math类)
public class Demo{
	
    public static void main(String[] args){
		
        //幂运算2^3    2*2*2=8
        double pow = Math.pow(2,3);
        System.out.println(pow);		//输出结果为8
        
        //更多运算与此类似, 自行百度
    }
}