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

How do I run java on windows?

1239


Can a set contain duplicates?

1000


Does printwriter create a file?

1012


What is oops in java?

1065


What is the function of compareto in java?

1116


What is boolean strategy?

1177


How large is a boolean?

1062


How to sort elements in a parallel array in java?

950


What is boolean query?

1037


Which is easier netbeans or eclipse?

1106


What is the difference between post and put?

1130


What is meant by oops concept in java?

1050


Explain about automatic type conversion in java?

1090


what state does a thread enter when it terminates its processing? : Java thread

1121


Explain the difference between runnable and callable interface in java?

1096