what happen if the private constructor is written in a claass
Answers were Sorted based on User's Feedback
Answer / venkateshk
If private constructor is written in a class is preventing
to create objects for the class from outside of class.
| Is This Answer Correct ? | 16 Yes | 0 No |
Answer / 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 |
Answer / ravi kumar
If we write the private constructor, it is not possible to
create the object for the class. If we want to create the
object for the class, we need to write the default
constructor, which is a public one.
| Is This Answer Correct ? | 0 Yes | 4 No |
why do we use logic tag library in struts?
is it possible to see actionservlet in my system. if yes how
What design patterns are used in struts?
What are the struts2 configuration properties that control file uploading process?
What is the forward action utilized for?
How to set email notification using struts.Plz give the example code?
What is struts actionmapping?
What is the use of jsonvalidation?
What is the need of struts?
What is form bean in struts?
Is struts efficient?
when we enter the data in the form how it is stored in formbean class setter and getter methods?