看板 [ java ]
討論串[問題] ?:問題
共 5 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者TonyQ (骨頭)時間19年前 (2006/06/19 19:42), 編輯資訊
0
0
1
內容預覽:
println. public void println(). Terminate the current line by writing the line separator. string. The line separator string is defined by the system p
(還有524個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者justinC (無)時間19年前 (2006/06/19 11:31), 編輯資訊
0
0
0
內容預覽:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^. 主要就這句!. 那像System.out.print應該就是傳回void?. 因為我剛剛試了. a=(a<1)?System.out.print("yes"):1;. --. 發信站: 批踢踢實業坊(ptt.cc

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者TonyQ (骨頭)時間19年前 (2006/06/19 05:39), 編輯資訊
0
0
0
內容預覽:
System.out.println( (a>=1)?"YES":"NO");. Java的 ?: 主要使用於傳值 , 而非執行動作...... --. String temp="relax"; | Life just like programing. while(buringlife) Strin
(還有188個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者cole945 (躂躂..)時間19年前 (2006/06/19 00:41), 編輯資訊
0
0
0
內容預覽:
其實主要問題是..java不支援像C的. int a=1;. a; <-- C/C++ ok, 可是java會抱怨 not a statement. 同理像. a+b;. a?b:c;. 這種都不行... 要用的話..可以前面加個 x= 來做偽assignment. (不過print是傳回void所

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者justinC (無)時間19年前 (2006/06/18 23:24), 編輯資訊
0
0
0
內容預覽:
int a=1;. a>=1?System.out.print("YES"):System.out.print("NO");. 我在java用這種寫法不行. 但在c++上的a>=?cout<<"yes":cout<<"no";卻可以. 請問java的三元運算子的使用(特性)是否有一點點較其他語言不同
首頁
上一頁
1
下一頁
尾頁