这样也可以
public class Helloworld { public static void main(String[] args){ int x =91; /*if(x % 2 == 0){ System.out.println("x是偶数"); }else { System.out.println("x是奇数"); }*/ String mark = ( x % 2 ==0)?"x是偶数":"x是奇数"; System.out.println(mark); } }
public class Helloworld { public static void main(String[] args){ int x =91; /*if(x % 2 == 0){ System.out.println("x是偶数"); }else { System.out.println("x是奇数"); }*/ String mark = ( x % 2 ==0)?"x是偶数":"x是奇数"; System.out.println(mark); } }
2016-10-30
举报