public static void main(String[] args) {
//方式1
int num=6;
if(num%2 == 0){
System.out.println(num + "是偶数");
}else{
System.out.println(num + "是奇数");
}
//方式2 位运算
if((num & 1) == 0){
System.out.println(num + "是偶数");
}else{
System.out.println(num + "是奇数");
}
}