重要:需要引入Scanner方法
import java.util.Scanner; 代码:主要是通过求余方式处理解决 Scanner get_number = new Scanner(System.in);int getNumber = get_number.nextInt();
if (getNumber % 2 == 0) {
System.out.println(getNumber + "为偶数");
} else {
System.out.println(getNumber + "为奇数");
} 标签:Java,Scanner,getNumber,奇数,System,偶数 From: https://www.cnblogs.com/Lee597/p/17603541.html