一命名二方法內部結構
序號 | 標志 | 代表的含義 |
---|---|---|
1 | b | boolean類型 |
2 | n | 數字類型 |
3 | s | 字符串類型 |
4 | d | 日期類型 |
5 | o | Object類型,如:Map、List、Object、Bean等 |
1、普通IF判斷,括號前后有空格,ELSE與上一節點的大括號在同一行。
if ("test".equals(sTest)) { //do some thing} else if ("other".equals(sTest)) { //do some thing} else { //do other thing}2、普通循環,將循環量在循環體之外定義。
int nCount = oList.size();for (int i = 0; i < nCount; i++) { //do some thing }3、存在Boolean返回值的方法,直接將結果返回。
public boolean checkModel(Model oModel) throws Exception { if (oModel == null) return false; //do some thing if (oModel.getXxx() > 500) return false; return true;}4、存在非Boolean返回值的方法,在開始時定義返回值,在方法的最后將結果返回。
public Model PRepareModel(String sGuid) throws Exception { Model oModel = new Model(); //do some thing return oModel;}新聞熱點
疑難解答