How do you implement singleton class?



How do you implement singleton class?..

Answer / Manish Kumar Prabhakar

"To implement a singleton class in Java, you can use the following techniques: 1. Eager Initialization (static block), 2. Lazy Initialization with double-checked locking, 3. Lazy Initialization using Enum, and 4. Bill Pugh Singleton."

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

Is java call by reference?

1 Answers  


Can vector have duplicates in java?

1 Answers  


Explain difference between final, finally and finalize?

3 Answers   Cognizant,


what is difference between Action messages and Action errors?

3 Answers   Bio Imagene, TCS,


Can I uninstall java?

1 Answers  


What sorting algorithm does javascript use?

1 Answers  


Why webdriver is an interface?

1 Answers  


Is intellij better than eclipse?

1 Answers  


Can we override the static method?

1 Answers  


why we are calling j2se why not j1se or j3se or j4se..etc is there any reason.. can u please explain it... i shocked in my interview when they asked this question please explain ans

2 Answers   Infosys,


What is the need of transient variables in Java ?

1 Answers   MCN Solutions,


solve (x-1)(x-9)=8;

3 Answers   IBM, Manhattan, TCS,


Categories