2010-4-27

 看了看singleton,貌似不是非常有用的模式了!用private的constructor,然后static的Factory方法提供单例!Factory中的instance当然也是static的。
 最重要的作用应该就是节省资源吧!还以为Calendar类也是singleton,因为它也是getInstance()方法来获得,google了一下,不是的,momo!通过getInstance是因为它的constructor是protected。 看来什么都不能想当然呀!它是每次都获得一个新实例!感觉这个应该可以作为单例吧。。。再看看~
 明天考试!bless!!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s