When should I use a singleton?
Answer / Nikhil Kumar Karn
Use a singleton when you want to ensure that only one instance of a class is created. This is useful in situations where you have a global configuration object, a database connection pool, or a logger.
| Is This Answer Correct ? | 0 Yes | 0 No |
What are the properties of thread?
How many tetrahedral voids are there in bcc?
what is servlet filter?
If goto and const is reserve words than why it is not work in java?
why java does not have operator overloading?
What is the difference between Checked and Unchecked exception? Give some examples
How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply?
4.1 Supply contracts (in the form of comments specifying pre- and post conditions) for the enqueue() method of the LinkedQueue class given in the Appendix. (2) 4.2 Let Thing be a class which is capable of cloning objects, and consider the code fragment: Thing thing1 = new Thing(); //(1) Thing thing2 = thing1; //(2) Thing thing3 = (Thing) thing1.clone(); //(3) Explain how the objects thing2 and thing3 differ from each other after execution of the statements. (
What is the lifetime and scope of a variable?
Can static methods be inherited?
Is ++ operator thread-safe in java?
What do you mean by exception handling in Java?