补充一点心得
* if(true/false) 一条java语句;
* 这种方式不推荐使用,别人这么写能看懂就行
阿里巴巴的华山版java开发规范是禁止了这种用法的(懒得截图了)
以下是google的
4.1.1 Braces are used where optional
Braces are used with if, else, for, do and while statements, even when the body is empty or contains only a single statement.
谷歌的规范使用了even when来强制禁止了这种用法
所以应该是“尽可能避免使用”、“不使用”,而不是“不推荐使用”