码迷,mamicode.com
首页 > 编程语言 > 详细

实习第16天 开新坑 Effective Java 英文 第二版 读书笔记

时间:2015-08-20 18:14:25      阅读:137      评论:0      收藏:0      [点我收藏+]

标签:

最近每天上班下班有点时间看下 Effective Java。

我一般看看原文,在看看示例代码,再想想原文的意思。

我英文也不是很好,所以决定中文英文随便用.

 

 

Creating and destroying objects

Item 1: Consider static factory methods instead of constructors 

Advantage of static factory methods

1.Unlike constructors. They have names.

 

2.They are not 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,DriverManager.getConnection is the service access API,and Driver is the service provider interface.

 

实习第16天 开新坑 Effective Java 英文 第二版 读书笔记

标签:

原文地址:http://www.cnblogs.com/linkarl/p/4745722.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!