public class HelloWorld {
public static void main(String[] args) {
int one = 20 ;
if((one %= 2) = 0);
System.out.println("one是偶数");
}
}
public class HelloWorld {
public static void main(String[] args) {
int one = 20 ;
if(one % 2==0){
System.out.println("one是偶数");
}
}
}
"="是赋值运算符,"=="是逻辑运算
赋值运算符==是等于,=也可以赋值,比如变量one=5,不就表示把5赋值给变量one吗?==和=有什么区别吗?谢谢!