一命名二方法内部结构
序号 | 标志 | 代表的含义 |
---|---|---|
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;}新闻热点
疑难解答