2. creating and destroying objects

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2. creating and destroying objects相关的知识,希望对你有一定的参考价值。

ref: book "Effective Java"

1. consider static factory methods instead of constructord

2. consider a builder when faced with many constructor parameters

3. enforce the singleton property with a private constructor or an enum type

4. enforce noninstantiability with a private constructor

5. avoid creating unnecessary objects

6. avoid finalizer

 

以上是关于2. creating and destroying objects的主要内容,如果未能解决你的问题,请参考以下文章