Capgemini placement question from previous years, Can any one answer?

What is singleton class? Where is it used?


6 Answers
1-6 of  6
6 Answers
  • A singleton class is a design pattern that restricts the instantiation of a class to a single instance, ensuring global access to that instance, typically through a private constructor and a public static method. It is commonly used for managing shared resources like database Buckshot Roulette connections, configuration settings, or logging services, helping maintain consistency and control across an application.
    0

  • A singleton class is a design pattern that ensures only one instance of the class is created and provides a global point of access to Flappy Bird that instance, commonly used for managing shared resources like configurations or connections.
    0

  • 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.
    2

  • 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. 
    0

  • I dont know.
    0

capgemini
Practice Mock Test
capgemini