what happen if the private constructor is written in a claass
Answer Posted / diego antonio
Yes! You can!
1.- You could have serveral constructors by requesting
different parameters set: if any of them is public, you can
use it.
2.- you could have an static method (which does not need
instance of the class) named, by example,
getNewInstance(...) which internally uses the private
constructor to instance a class (as in the factory pattern),
or as in the Singleton pattern to get the only one instance
(private and static instance).
3.- If several constructors exists, the private ones could
be called from others, but never used externally to the
class implementation.
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the purpose of struts.xml in struct2?
What is the use of lookupdispatchaction?
Explain architecture of struts2?
What is the different actions available in struts?
Are interceptors thread safe?
How many Action classes have been used in your project? Differences between struts 1.1 and 1.3?
What is token used for?
What is the default suffix for Struts2 action URI and how can we change it?
Name some useful annotations introduced in Struts2?
What is s token?
What are the steps required for setting up validator framework in struts?
What is the purpose of @element annotation annotation?
Can you explain struts.properties in struts2?
while working struts in intellij 7.0error unable to initialize tld location cache: zip file is closed is displayed anybdy can answer me immdialy .ungert
Which servlet does the struts framework use?