If without else ternary operator

前端 未结 10 725
太阳男子
太阳男子 2020-12-05 17:04

So far from I have been searching through the net, the statement always have if and else condition such as a ? b : c. I would like to know whether the if<

10条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-05 17:43

    Why using ternary operator when you have only one choice?

    if (pstmt != null) pstmt.close(); 
    

    is enough!

提交回复
热议问题