基本运算符
package operator;
/**
* @version: java version 1.8
* @Author: Mr Theroux
* @description:
* @date: 2024-08-19 17:06
*/
public class Demo01 {
public static void main(String[] args) {
int a = 10;
int b = 20;
int c = 25;
int d = 30;
System.out.println(a+b);
System.out.println(a-b);
System.out.println(a*b);
System.out.println(a/b);
System.out.println(a/(double)b);
}
}
package operator;
/**
* @version: java version 1.8
* @Author: Mr Theroux
* @description:
* @date: 2024-08-19 17:08
*/
public class Demo02 {
public static void main(String[] args) {
long a = 12312313121L;
int b = 17;
short c= 10;
byte d = 2;
System.out.println(a+b+c+d);//long
System.out.println(b+c+d);//int
System.out.println(c+d);//int
}
}
package operator;
/**
* @version: java version 1.8
* @Author: Mr Theroux
* @description:
* @date: 2024-08-19 17:15
*/
public class Demo03 {
public static void main(String[] args) {
//关系运算符返回的结果只有正确和错误 true false
//if接合
int a = 10;
int b = 20;
int c = 30;
System.out.println(c%b);
System.out.println(a>b);
System.out.println(a<b);
System.out.println(a==b);
System.out.println(a!=b);
}
}
标签:基本,int,System,运算符,version,println,public,out
From: https://www.cnblogs.com/theroux/p/18367729