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
Which configuration file is used for storing jsp configuration information in struts?
What is dispatch action class?
What is the actionform?
How can we group related actions in one group in Struts?
What are the two different types of validations that the validator framework supports?
Define struts?
Which class of struts is responsible to converts data types from string and vice versa?
Will the struts tags support other markup languages such as wml ?
What kind of mvc is struts 2?
Describe the mvc on struts?
What configuration changes are required to use resource files in Struts?
What is the purpose of redirect result type?
What is java struts?
What is the difference between struts and spring? Explain
What is apache struts cve 2017 5638?