Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What are Struts2 core components?

1059


How you will make available any message resources definitions file to the struts framework environment?

1030


Can we have more than one struts-config.xml file for a single struts application?

980


How can link tag’s action attribute be used?

1001


What is the purpose of @conversion annotation annotation?

1326


What does action do in struts?

1061


How the exceptions are handled in struts?

1070


What are the important methods of actionform?

1148


What configurations are stored in struts configuration file ?

1061


What is used to display the intermediate result in an interceptor?

1004


When should we use SwtichAction?

1119


What is interceptor in Struts2?

1032


Which configuration files are used in struts?

1018


What is the role of action class?

1086


What are the differences between Struts1 and Struts2 or how Struts2 is better than Struts1?

1062