Code Review
1 package Question; 2 3 public class Q2 { 4 private int maxRevolution; 5 private int Revolution; 6 private int gears; 7 private double dia; 8 private String colour; 9 private String state; 10 11 public Q2() { 12 13 } 14 15 16 17 public Q2(int maxRevolution, int revolution, int gears, double dia, String colour, String state) { 18 super(); 19 this.maxRevolution = maxRevolution; 20 Revolution = revolution; 21 this.gears = gears; 22 this.dia = dia; 23 this.colour = colour; 24 this.state = state; 25 } 26 27 28 29 public int getMaxRevolution() { 30 return maxRevolution; 31 } 32 33 public void setMaxRevolution(int maxRevolution) { 34 this.maxRevolution = maxRevolution; 35 } 36 37 public int getRevolution() { 38 return Revolution; 39 } 40 41 public void setRevolution(int revolution) { 42 Revolution = revolution; 43 } 44 45 public int getGears() { 46 return gears; 47 } 48 49 public void setGears(int gears) { 50 this.gears = gears; 51 } 52 53 public double getDia() { 54 return dia; 55 } 56 57 public void setDia(double dia) { 58 this.dia = dia; 59 } 60 61 public String getColour() { 62 return colour; 63 } 64 65 public void setColour(String colour) { 66 this.colour = colour; 67 } 68 69 public String isState() { 70 return state; 71 } 72 73 public void setState(String state) { 74 this.state = state; 75 } 76 77 78 79 @Override 80 public String toString() { 81 return "Fan [maxRevolution=" + maxRevolution + ", Revolution=" + Revolution + ", gears=" + gears + ", dia=" 82 + dia + ", colour=" + colour + ", state=" + state + "]"; 83 } 84 85 86 87 public static void main(String[] args) { 88 89 Q2 status = new Q2(); 90 91 System.out.println(status); 92 } 93 }
1.代码没有固定的格式很凌乱
2.类名变量名取得没有意义
3.代码没有注释
4.部分没用的代码没有注释