What is a singleton class in Java? And How to implement a singleton class?
Answers were Sorted based on User's Feedback
Answer / nashiinformaticssolutions
A singleton class is one that can only have one object at a time. The following procedures must be followed in order to implement a singleton class:
Verify that there is only one object in the class.
Allow the item to be accessed globally.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / 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 |
when you will synchronize a piece of your code? : Java thread
Does anyone still use java?
How to sort numbers in java without array?
Can we iterate through collection using for loop?
whats the life cycle of jsp
Define an enumeration?
What modifiers can be used with a local inner class?
What is meant by memory leak?
Can a class have multiple constructors?
What do you know about the garbage collector?
How do generics work?
Does treeset use compareto?