What is singleton class?

Answer Posted / ashish srivastava

public class Singleton {

private static Singleton s = new Singleton();

private Singleton(){

}

public static Singleton getObject(){
return s;
}

}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how we can create packages in java?

692


When is the finalize() called? What is the purpose of finalization?

796


What are the differences between include directive and include action?

745


What is jar?

811


What is the difference between a field variable and a local variable?

752


What is an object's lock and which object's have locks in java programming?

745


What are unchecked exceptions in java?

791


State the difference between creating string as new () and literal.

700


What is the synchronized method modifier?

810


How do you represent a space in regex java?

699


What is string pool?

791


What is a numeric literal?

715


What is default exception handling in java?

746


What is the difference between notify and notifyall method?

804


What are the different ways of implementing thread? Which one is more advantageous?

726