one是偶數
public class HelloWorld { ? ?public static void main(String[] args) { int one = 20 ; ? ? ? ?String s = ((one%2==0)?"偶數":"非偶數"); ? ? ? ? ? ?System.out.println("one是"+s); ? ? } }
public class HelloWorld { ? ?public static void main(String[] args) { int one = 20 ; ? ? ? ?String s = ((one%2==0)?"偶數":"非偶數"); ? ? ? ? ? ?System.out.println("one是"+s); ? ? } }
2016-10-07
舉報
2016-10-07
沒錯啊,三目運算符