标签:
普通程序员和高级程序员的区别是:普通程序员用复杂的代码解决简单的问题;而高级程序员能把复杂的问题简单化并用简洁的代码去实现。String str = ""; String src = ""; int count = 0; int total = 0;高级程序员:
String str = org.apache.commons.lang3.StringUtils.EMPTY , src = org.apache.commons.lang3.StringUtils.EMPTY; // 多使用常量 int count = 0 , total = 0;2.get/set方法的用法:
String str = obj.getStr(); String src = str + "src"; String test = test(); String result = result(test);高级程序员:
String src = obj.getStr() + "src"; String result = result(test());3.if比较的习惯用法:
if(i==1) System.out.println(i); public void test(){ if(5<=j){ System.out.println("j大于等于5"); if(10<=j){ System.out.println("j大于等于10"); ... } } }高级程序员:
if(i==1) System.out.println(i); public void test(){ if(j<5) return; System.out.println("j大于等于5"); if(j<10) return; System.out.println("j大于等于10"); ... }4.try/catch的用法:
public boolean test(){ try{ String str = "" , src = ""; ... return true; }catch(Exception e){ e.printStackTrace(); return false; } }高级程序员:
public boolean test(){ String str = "" , src = ""; try{ ... return true; }catch(Exception e){ logger.error(...); } return false; }5.关于for循环创建对象:
for(int i=0;i<list.size();i++){ User user = new User(); user.setAge(20); ... }高级程序员:
int size = list.size(); User user = new User(); for(int i=0;i<size;i++){ user.setAge(20); ... }暂时就写这么多吧,以后有时间了在补充更新!
标签:
原文地址:http://blog.csdn.net/xmtblog/article/details/50205201