源代码: public boolean isGOD() { String userName = getLoginUserNick(); if (userName.equals(GOD_NAME)) { return true; } return false; } 重构后: public boolean isGOD() { return GOD_NAME.equals(getLoginUserNick()); }