Sapient Company Programming

In Which of the following situations is it best to use Singleton?

1) If an object has READ_ONLY state (all attributes are final)

2) If an obejct does not have any state (say, no attributes, only methods)

3) If an object has shared state (attributes are present, but those are modified by many of the other objects)

4) All of the given options

Read Solution (Total 1)

Sapient Other Question

Which of the following sequences of Fragment lifecycle methods is correct?

1) onAttach() --> onStart() --> onCreate() --> onCreateView() --> onActivityCreated() --> onResume()

2) onAttach() --> onCreate() --> onStart() --> onCreateView() --> onActivityCreated() --> onResume()

3) OnAttach() --> onCreate() --> onCreateView() --> onActivityCreated() --> onStart() --> onResume()

4) onAttach() -->onStart() --> onCreate() --> onActivityCreated() --> onCreatedView() --> onResumse()
Bob figured out that in his Java applications only one runtime enviroment is possible and that is actually true
Bob would like to make Runtime class a _______

1) Singleton class
2) Abstract class
3) Static classs
4) Final class