14

方式 1 和方式 2 的却别到底在哪里?

 4 years ago
source link: https://www.v2ex.com/t/620135
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Java - @Simle100 - 在开发中对于 a/b,这样的表达式,我们要做 b 的校验。但有两种方式:方式 1:if ( b == 0 ) { // 提示除数不能为 0}方式 2:try{ a / b;

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK