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 |
I want to persist data of objects for later use. What’s the best approach to do so?
what is difference betweem home interface and remote interface?
What is difference between Heap and Stack Memory?
System.out.println(101/14) what is the output? a)6 b)14 c)7.14 d)0
What do you mean by local variable and instance variable?
Can we override constructor in java?
how to create constants in java?
What is annotation in java?
What is the difference between preemptive scheduling and time slicing?
What are the main uses of java?
What is meant by memory leak?
Explain the scope of a variable.