Item 1: Consider static factory methods instead of constructors
实际应用:
package java.lang; public final class Boolean implements java.io.Serializable, Comparable<Boolean> { public static final Boolean TRUE = new Boolean(true); public static final Boolean FALSE = new Boolean(false); .... private final boolean value; .... public Boolean(boolean value) { this.value = value; } .... public static Boolean valueOf(boolean b) { return (b ? TRUE : FALSE); } .... }
构造器(Constructor)
https://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8
方法签名(method signature)
https://docs.oracle.com/javase/tutorial/java/javaOO/methods.html
基本类型和引用类型(PrimitiveType and ReferenceType)
https://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.1
== 和 equals(Object obj)
https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html