Best Answer

It becomes a singleton class.

User Avatar

Wiki User

โˆ™ 2012-09-05 15:18:49
This answer is:
User Avatar
Study guides


See all cards
26 Reviews

Add your answer:

Earn +20 pts
Q: What will happen if you declared constructor in private section?
Write your answer...
Still have questions?
magnify glass
Related questions

Can constructor be declared as constant in c plus plus?

No. Constructors initialise objects and, by definition, must be able to modify the member variables. Uninitialised members are a disaster waiting to happen even without a constructor declared const! Thankfully, the compiler won't permit a const constructor.

When did Soda Constructor happen?

Soda Constructor happened in 2000.

What will happen when the class is declared as private in java?

Hi, you can not declare your class as private except that is inner class.

What happen when static data field is initialised in a non static constructor?

It got initialized as you instructed.

Can you override the constructor?

No. You cannot override the constructor. You can only overload them.You can argue that, during inheritance if you provide a child class constructor it should override the parent class constructor. Unfortunately, that doesnt happen. The parent class constructor will get called eventually and you cant block it.Such a situation is called Constructor ChainingConstructor ChainingWe know that constructors are invoked at runtime when you say new on some class type as follows:Lamborghini h = new Lamborghini();But what really happens when you say new Lamborghini() ? (Assume Lamborghini extends Car and Car extends Object.)1. Lamborghini constructor is invoked. Every constructor invokes the constructor of its superclass with an (implicit) call to super(),2. Car constructor is invoked (Car is the superclass of Lamborghini).3. Object constructor is invoked (Object is the ultimate superclass of all classes, so class Car extends Object even though you don't actually type "extends Object" into the Car class declaration. It's implicit.) At this point we're on the top of the hierarchy.4. Object instance variables are given their explicit values. By explicit values, we mean values that are assigned at the time the variables are declared, like "int x = 27", where "27" is the explicit value (as opposed to the default value) of the instance variable.5. Object constructor completes.6. Car instance variables are given their explicit values (if any).7. Car constructor completes.8. Lamborghini instance variables are given their explicit values (if any).9. Lamborghini constructor completes.

When did Private Garden happen?

Private Garden happened in 1997.

When did Section Z happen?

Section Z happened in 1985.

Where should your first kiss happen?

On the lips, in private.

Do you have to become a police officer to become a private detective?

No but many private investigators happen to be ex-officers.

Can membership to a private organization be restricted by gender?

Unfortunatly, it does happen, and yes. Organizations that are private (you have to pay to belong) can do this.

Private property repossesion?

What will happen when your property is auctioned off?

What do you do if a zombie apocalypse happend?

Its impossible for it to happen scientists have declared it impossible stop worrying about what to do

People also asked