public class HelloWorld { public static void main(String[] args) { int one = 20 ; String s = ((one%2==0)?"偶数":"非偶数"); System.out.println("one是"+s); } }
没错啊,三目运算符