More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
We need methods to access variables in a polymorphic way as overriding only happens with methods and not with variables. Moreover getter provides a way to minimally open the access window for the object and hence provides better encapsulation. To add to those, we can have validation in the getter method before returning elements.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Deserialization. In serialization, we can save the object of a byte stream into a file or send over a network. Suppose if you serialize the Singleton class, and then again de-serialize that object, it will create a new instance, hence deserialization will break the Singleton pattern.
To overcome this issue, we need to override readResolve() method in the Singleton class and return the same Singleton instance.
Help us improve. Please let us know the company, where you were asked this question :
Ans. In GUI programming, an object that can be registered to be notified when events of some given type occur. The object is said to listener? for the events.
Help us improve. Please let us know the company, where you were asked this question :
Ans. It is part of the analysis of a program and describes a situation that a program might encounter and what behavior the program should exhibit in that circumstance.
Help us improve. Please let us know the company, where you were asked this question :
LikeDiscussCorrect / Improve  use cases   design   high level design   testing   test driven development   software system analyst   project lead basic   frequent
Very frequently asked. Usually followed by questions related to private constructor and synchronized access. Frequently asked in JPMorgan and TCS (Based on 2 feedback)
Q44. Shouldn't we make a class with all static members is its just expected to be executed as a standalone program with just one thread. Moreover Lets assume that there is no runtime Polymorphism required and there is no need for serialization ?
Ans. Still No in case we are making use of inheritance. we may have problem wherein we have program flow moving across common inherited method and specific methods of the derived class. call made to another static method in the parent class will only access the static class of the Parent class irrespective of the call from any of the derived class.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Use Case Diagram, Component Diagram for High level Design and Class Diagram , Sequence Diagram for low level design.
Help us improve. Please let us know the company, where you were asked this question :
LikeDiscussCorrect / Improve  software system analyst   development lead   project lead   technical lead   technical architect expert   frequent
Q47. What kind of software architecture your organization follow ?
Ans. We have multi tier architecture with multiple layers , We have series of web servers and applications in application tier, infrastructure libraries at middle tier and Database servers at the lower tier. We are using Oracle as Database, ESB ( Enterprise service Bus ) for asynchronous communication and Rest Web Services.
Help us improve. Please let us know the company, where you were asked this question :
LikeDiscussCorrect / Improve  software system analyst   development lead   project lead   technical lead   technical architect
Q48. Which of the following is not the difference between Singleton and Static class ( Class with static members only ) ?
a. Only one object can be created for Singleton class whereas No objects are created for static class. b. Singleton class instance is initiated using new keyword whereas static class instance is created using static method. c. Singleton class can be serialized whereas Static class cannot be. d. Singleton Class can participate in runtime Polymorphism whereas Static class cannot.
Ans. Singleton class instance is initiated using new keyword whereas static class instance is created using static method.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Fail Safe systems are tolerant systems that continue processing even if they sense any problem. the objective here is to continue with the processing even if there are some problems instead of completely shutting it down. Example could be to catch an exception and still letting it complete with partial results.
Help us improve. Please let us know the company, where you were asked this question :
Ans. TDD is a development process that involves short iterations: first an automated test case is written. Then, the code is written to pass that test, and finally one refactors the new code to acceptable standards.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Fail fast systems are intolerant systems that fails at the first instance of smelling any problem. The objective here is to break the system instead of continuing with the possibly flawed processing. Example could be breaking the processing upon an exception.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Web Service promotes looser coupling but with comes with coding and performance overheads. Jars provide better performance and may be lesser coding but are problematic with update distribution. If the situation doesn't require frequent dependency updates and if it's only read operation of persistence, Having dependencies should be a better choice , otherwise web service.
Help us improve. Please let us know the company, where you were asked this question :
Ans. It make sense only if we intend to modify either of the object and would like to preserve original state in other. Otherwise we can reuse the original object by making it singleton.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Yes , it can be but it may not be an optimal alternative if we need to change the values frequently. As Enum is compiled like any Java File , any change requires the application to be rebuild , deployed and restart.
Help us improve. Please let us know the company, where you were asked this question :