三目运算符

 1 import java.util.Scanner;
 2 
 3 
 4 //三目运算符
 5 public class SingleQuestion{
 6     public static void main(String args[]){
 7         int x = 10;
 8         int y = 9;
 9         int max = x > y ? x : y;
10         System.out.println("较大的数字是:"+ max);
11     }
12 }

 

posted @ 2016-11-07 19:07  cheney-yang  阅读(225)  评论(0编辑  收藏  举报