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

Explain the life cycle of a request in struct2 application?

866


What is the purpose of struts.xml in struct2?

1076


Which interceptor is responsible for file upload support?

977


What is actionmapping?

1034


What is the actionform?

974


Explain about the process of functioning of the struts program?

977


How do you create message resource?

962


Give an example of validates method used to avoid errors.

930


What is the purpose of '@keyproperty'?

973


What are the reasons for an error message not being displayed while developing struts application?

894


What do you mean by struts.dev mode?

912


Explain about struts dispatch action?

925


What is the purpose of @result annotation?

1069


For a single Struts application, can we have multiple struts-config.xml files?

937


What are the classes used in struts?

1042