What is a singleton class in Java? And How to implement a singleton class?

Answer Posted / nashiinformaticssolutions

A class that can possess only one object at a time is called a singleton class. To implement a singleton class given steps are to be followed:
1. Make sure that the class has only one object
2. Give global access to that object

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can arraylist hold different types java?

682


Describe the syntax of multiple inheritance? When do we use such an inheritance?

803


What are the different types of java?

745


What is meant by the value of a variable?

662


What is exception in java?

741


What is method in java with example?

691


List implementations of list interface?

777


Which is better stringbuffer or stringbuilder?

708


What is string buffer?

709


Can memory leak in java?

775


What is isa relationship?

748


How does a cookie work in Servlets?

564


What is Java Annotations?

728


Can java inner class be static?

737


What do you understand by soft reference?

797