java interview questions and answer what is singleton class exaplain

3,730 views · Published 30 September 2012 · 2:52 · Indexed 15 October 2026

Channel: Interview DOT · 2012 · Science & Technology

Watch on YouTube

Click here - https://www.youtube.com/channel/UCd0U_xlQxdZynq09knDszXA?sub_confirmation=1 to get notifications. JOB VACANCIES IN TOP IT / NOT-IT COMPANIES

UPLOAD YOUR RESUME IN 1 MINUTE ! ! !
http://www.interviewdot.com/upload-resume/uploadresume.htm

http://www.interviewdot.com


Welcome to www.interviewdot.com

Top Java interview questions and answers :

http://www.interviewdot.com


What is singleton class ? 
It is one of the basic object oriented design pattern.
This falls in the creational pattern of the design pattern. 
There will be only one instance for that entire JVM. 
You can achieve this by having the private constructor in the class. 
For eg., 
public class SingletonInterviewDot {  
private static final SingletonInterviewDot  = new SingletonInterviewDot (); 
private Singleton() { }// No one can create your object

public static synchronized         SingletonInterviewDot         getInstance() {
 return SingletonInterviewDot ;
 } // all non static methods ... }

For more Java interview questions and answers logon to www.interviewdot.com -- India's top interview guide

http://www.interviewdot.com

More from this channel