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 construction struts?
Can you explain struts validator framework?
List the important attribute and elements of action mapping under struts.
What is an interceptor stack?
What is interceptor? And life cycle methods of interceptor?
Which technologies can be used at view layer in struts?
What is the purpose of struts.properties in struct2?
What is spring and struts in java?
Which class is the Front Controller in Struts2?
What is strut web xml?
What is the purpose of @emailvalidator annotation?
Provide some important Struts2 constants that you have used?
What is the apache struts vulnerability?
What is the purpose of @element annotation annotation?
What is form bean in struts?