1. if(username.equals("zxx"){}
2. int x = 1;
return x==1?true:false;
------ Solution ------------------------------------- -------
first one username may be null null pointer exceptions should be placed in front of the zxx
second trinocular operation is redundant, direct return x == 1 on the line
------ Solution ---------------- ----------------------------

1 when comparing constants and variables , constants, up front , to avoid variable is empty due to a null pointer
2 return x == 1 is enough, back ? : superfluous , pointless
------ For reference only - -------------------------------------
Thank
- ---- For reference only ---------------------------------------
< br /> Thank
没有评论:
发表评论