生活随笔
收集整理的這篇文章主要介紹了
三元运算符和总结
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
三元運算符和總結
運算符的優先級 ()
條件運算符
package operator
;public class Demo07 {public static void main(String
[] args
) {int a
=10;int b
=20;a
+=b
;a
-=b
;System
.out
.println(a
);System
.out
.println(""+a
+b
);System
.out
.println(a
+b
+"");}
}
三元運算符
package operator
;
public class Demo08 {public static void main(String
[] args
) {int score
=80;String type
= score
<60?"不及格":"及格";System
.out
.println(type
);}
}
總結
以上是生活随笔為你收集整理的三元运算符和总结的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。