int number = 18; number = number % 2; if (number == 1) { System.out.println("奇数" );} else { System.out.println("偶数" );}