Capgemini placement question from previous years, Can any one answer?
What is singleton class? Where is it used?
  • AT
  • Aarti
  • 17 oct.
  • 1155 Visto
  • 3 Respuestas

3 Respuestas
1-3 of  3
3 Respuestas
  • Yes, I can answer:

    Singleton is a design pattern meant to provide one and only one instance of an object. Other objects can get a reference to this instance through a static method (class constructor is kept private). Why do we need one? Sometimes it is necessary, and often sufficient, to create a single instance of a given class. This has advantages in memory management, and for Java, in garbage collection. Moreover, restricting the number of instances may be necessary or desirable for technological or business reasons-for example, we may only want a single instance of a pool of database connections.


  • I dnt know full answer, but can tell you what is "Singleton Class"?
    It is a design pattern meant to give one and only one instance of an object. 


  • I dont know.


Capgemini
Practica simulacro de prueba para
Capgemini