• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • YouClaw
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Jelly#布丁
我希望世界上不再有战争,我希望和我爱的人永远在一起
博客园    首页    新随笔    联系   管理     

JAVA代码规范

1、String对象比较时不使用==或!=,而是用equals方法。

2、定义对象如下时:

1 List<Ctte> cttes = new ArrayList<Ctte>();
2 cttes = ctteDao.getCtteList(schoolID,pagination.getPageSize(), pagination.getPageNumber());
这里,你声明了一个dead store.什么是dead store?

 In Computer programming, if we assign a value to a local variable, but the value is not read by any subsequent instruction, then it's called a Dead Store.

如果是这种情况,则直接这样定义:

List<Ctte> cttes = null;
cttes
= ctteDao.getCtteList(schoolID,pagination.getPageSize(), pagination.getPageNumber());

 

posted on 2010-05-26 09:46  Jelly#布丁  阅读(133)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3