Java三目运算符
摘要: public class Java08{ 公共静态void main(String[]args){ //(8)三目运算符 //(true/false)?结果A:结果B //int a=(false?2:3); //System.out.println(A); int a=2; int b=3; int c=(A B)?A:b;
public class Java08 {
public static void main(String[] args) {
// (8)三目运算符
// (true/false)?结果A:结果B
// int a = (false ? 2 : 3);
// System.out.println(a);
int a = 2;
int b = 3;
int c = (a b) ? a : b;
System.out.println(c);
int x = Math.max(5, 6);
System.out.println(x);
我来说两句