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

What is empty string literal in java?

564


What are the restriction imposed on a static method or a static block of code?

597


What's the purpose of using break in each case of switch statement?

514


How many types of equations are there?

544


What are the 6 mandatory procedures for iso 9001?

532






What is Mutex (Mutual Exclusion Object) ?

629


Give example to differentiate between call by value and call by reference.

596


What is lambda in java?

521


What are the types of java languages?

519


What is the purpose of declaring a variable as final?

488


When a lot of changes are required in data, which one should be a preference to be used? String or stringbuffer?

767


List implementations of list interface?

565


Is alive and join method in java?

540


Explain 5 features introduced in jdk 1.7?

613


What are the differences between wait() and sleep()?

541