示例代码如下:
public class HelloWorld{
public static void main (String args[]){
int a = 6;
int b = 5;
int c = 8;
// int temp = a > b ? a : b;
// int max = temp > c ? temp : c;
int max = (a > b ? a : b) > c ? (a > b ? a : b) : c;
System.out.println(max);
}
}
原文:https://www.cnblogs.com/gmbjzg/p/14611778.html