本文目录一览:
JAVA赋值运算符
public class A{
int one = 10;
int two = 20;
int three;
public static void main(String[] args){
System.out.println(three = one + two);
System.out.println(three += one);
System.out.println(three -= one);
System.out.println(three *= one);
System.out.println(three /= one);
System.out.println(three %= one);
}
}
JAVA的赋值运算符
2-3=-1
2/3=0.66667 转换成int型,去掉小数就是0
2%3=0......2 取余数 就是2
java中的赋值运算符怎么用
// Java中的赋值符号为“=”(不算双引号)
int a;// 定义整型变量a
a=1;// 给a赋值,值为整数1