直接上代码!复习基础!

public static void main(String args[]){
int a , b;
a = 10;

b = (a == 1) ? 20: 30;//如果a等于1那么b就等于20,否则等于30

System.out.println( "Value of b is : " + b );
b = (a == 10) ? 20: 30;
System.out.println( "Value of b is : " + b );

}
}

打印:

Value of b is : 30
Value of b is : 20

相关文章:

  • 2021-12-13
  • 2022-01-04
  • 2022-12-23
  • 2021-06-25
  • 2021-08-30
  • 2022-12-23
  • 2021-05-22
猜你喜欢
  • 2022-02-10
  • 2022-01-06
  • 2021-12-06
  • 2021-06-28
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案