|
Written by Sleepy Egg
|
|
Thursday, 23 June 2005 |
|
singleton is a design pattern that focus on object creation. When a class is implemented using singleton, one and only one such instance can be created in a JVM. Usual implementation will be:
1. making constructor private
2. use a public static "getInstance" method to get an instance object
3. use either lazy instantiation or instantiate it statically
4. if lazy instatiation is used, must synchronized "getInstance" method.
5. the singleton object is private static instace field
In some cases you may prefer a abstract class with all static methods. |
|
|
Written by Sleepy Egg
|
|
Thursday, 23 June 2005 |
|
SleepyEgg community is now open for public! If you have any question or comment please email us at:
This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
Enjoy and have fun! |
|
|
<< Start < Prev 151 152 Next > End >>
|
| Results 1511 - 1512 of 1512 |