1
2
3
4
5
int val=//一个数字
 if(val%2==0)
   System.out.println("偶数");
else
  System.out.println("奇数");

https://blog.csdn.net/x369201170/article/details/8611485