方法排序规范——《Thinking in Java》随笔007

 1 package cn.skyfffire;
 2 
 3 /**
 4  * 
 5  * @author skyfffire
 6  * 
 7  * 按照权限顺序:public, protected, default, private来排序方法和属性, 可以使代码清晰度更高
 8  *
 9  */
10 public class Standard {
11     private int width;
12     
13     public int getWidth() {
14         return width;
15     }
16     public void setWidth(int _width) {
17         if (is(_width)) {
18             width = _width;    
19         }
20     }
21     
22     private boolean is(int _width) {
23         return (_width >= 20 && _width <= 300);
24     }
25 }
原文地址:https://www.cnblogs.com/skyfffire/p/6474740.html