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 is private constructor?what are the uses of writing
private constructor in our program?

Answer Posted / poonam suryawanshi

When we create a private constructor, we cannot create
object of the class directly from a client. So we will use
private constructor when we do not want instances of the
class to be created by any external client. Even it does not
allow us to inheritance of the class in another class.

Example Utility functions in project will have no instance
and be used without creating instance, as creating instances
of the class would be waste of time. When we create the
Private Constructor we have to make all the Variables and
Function as static.

Is This Answer Correct ?    6 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is main method?

1098


What is the difference between pass by reference and pass by pointer?

1182


What is double checked locking in singleton?

1107


Is singleton class thread safe?

1057


Which sorting is best in java?

1044


What is the difference between a checked and an unchecked exception?

1045


Can we create an object of private class?

1025


Should database connections be singleton?

1018


What state does a thread enter when it terminates its processing in java programming?

1089


What is executor memory?

1007


What is string manipulation?

1066


How do I type unicode?

1030


Explain about object oriented programming and its features?

1070


What two classes are used to read data only?

1144


Is string a wrapper class?

1063