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

How does multithreading take place on a computer with a single cpu?

546


When we serialize an object does the serialization mechanism saves its references too?

509


Why is whitespace important?

557


What is immutable data?

584


How to convert string to byte array and vice versa?

588






What is a website container?

509


Difference between operator overloading and function overloading

614


Can a hashset contain duplicates java?

497


Give any two differences between C++ and java.

561


Which number is denoted by leading 0x or 0x in java?

564


Can we use catch statement for checked exceptions?

518


What is threaded programming and when is it used? : Java thread

535


What are format specifiers in java?

599


What are the advantages of unicode?

546


Explain how hashmap works?

592