首页 > 编程语言 > 详细

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

时间:2015-08-20 18:12:46      阅读:142      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!