I have a little time to go to work every day to see effective Java.
I usually look at the original text, look at the sample code, and then think about the original meaning.
My English is not very good, so decided to use Chinese and English casually.
Creating and destroying objects
Item 1:consider Static factory methods instead of constructors
Advantage of Static factory methods |
1.Unlike Constructors. They has names. |
2.They is required to create a new object each time they ' re invoked. |
3.They can return an object of any subtype of their return type. |
4.They reduce the verbosity of creating parameterized type instances. |
1.
Public Static Boolean ValueOf (boolean b) { return b? Boolean.TRUE:Boolean.FALSE;}
3.
A Service provider Framework.
In the case of JDBC. Connection plays the part of the service Interface,drivermanager.registerdriver is the provider registration Api,driverman Ager.getconnection is the service access Api,and Driver is the service provider interface.
Internship 16th day Open new pit effective Java English second Edition reading notes