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

Answers were Sorted based on User's Feedback



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

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

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

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

Post New Answer

More Core Java Interview Questions

What does the exclamation mark mean in java?

0 Answers  


What is == mean?

0 Answers  


What is difference in between java class and bean?

0 Answers  


How do you create a null object?

0 Answers  


Does java runtime require a license?

0 Answers  


Are global variables initialized to zero?

0 Answers  


Can we execute a program without main?

0 Answers  


How do you achieve polymorphism in java?

0 Answers  


What are the 6 functions?

0 Answers  


Implement two stacks using a single array.

0 Answers   Global Logic,


hr interview how many minutes asking question

0 Answers  


What is the collections api?

0 Answers  


Categories