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 are action errors?
Describe validate() and reset() methods.
What is the purpose of action tag in struts.xml?
What are pull and push mvc architecture and which architecture does struts2 follow?
Is struts compatible with other java technologies?
Explain about struts relation to html tags?
What is the difference between session scope and request scope when saving formbean ?
What is difference between actionform and dynaactionform?
Who wrote struts?
What are the loop holes of struts?
What are the core components of a struct2 based application?
What is the purpose of @emailvalidator?
What is difference between spring and struts?
What are the 5 constants of action interface?
in struts how to use hibernate with struts>