How to implement Singleton

Answer Posted / ajooba

since 1.5 version best way is to use an enum

public enum My
{
instance;
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is sizeof () operator?

771


Does substring create a new object?

782


What is a conditional statement explain with example?

792


Why java does not support pointers?

811


What is the difference between a synchronized method and a synchronized block?

892


What are meta-annotations?

759


What does super keyword do?

803


What is the use of jtable?

891


What is array list in java?

850


How to sort an unsorted array in java?

897


Can we have return statement in finally clause? What will happen?

772


What is the disadvantage of synchronization?

802


What lambda means?

778


What is passing parameters in java?

765


When arithmeticexception is thrown?

828