answersLogoWhite

0

Software and Applications (non-game)
Computer Programming
Java Programming
C Programming

What will happen if you declared constructor in private section?


Top Answer
User Avatar
Wiki User
Answered 2012-09-05 15:18:49

It becomes a singleton class.

001
๐Ÿ™
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0
User Avatar

Your Answer

Loading...

Still have questions?

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.


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.


Where should your first kiss happen?

On the lips, in private.


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.


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

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


What happen December 11th 1941 in us?

germany and italy declared war on america


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


Private property repossesion?

What will happen when your property is auctioned off?


Does a tornado happen on the coast or in the interior section of the US?

It can happen in both places, but is most common in the interior.


If an epidemic were declared in your town. What could happen to control and eventually eliminate it?

can you please answer my question?


Can the president stay in office if war is declared?

Plain and Simple answer here....."YES" but why what has to happen what are the stipulations to that?


What happen on the 4 august1914 in world war 1?

Great Britian declared war on Germany.


What happen if you declare a global variable as static in C language?

When declared as static, the variable has internal linkage and its scope is restricted to the *.c file in which it is declared. It becomes visible to all functions within the file where it is declared and not to functions in other files.


Code to unlock an incoming private number?

never happen this option


What will happen if a private ip address is assigned to a public interface connected to an isp?

Address in a private range will not be routed on the internet backbone


Earthquakes happen when what section of the earths crust move?

The tectonic plates.


How a child is born?

A child can be born vaginally or by a C-section. Births can be scheduled with a C-section or may happen at anytime vaginally.


What happen when someone is on Section 8 and recieves an inheritience ?

All outside income is held in a trust until the Section 8 is complete.


What is a constructor and what are its special properties?

A constructor creates an Object of the class that it is in by initializing all the instance variables and creating a place in memory to hold the Object. It is always used with the keyword new and then the Class name.For instance, new String(); constructs a new String object.Sometimes in a few classes you may have to initialize a few of the variables to values apart from their predefined data type specific values. If java initializes variables it would default them to their variable type specific values. For example you may want to initialize an integer variable to 10 or 20 based on a certain condition, when your class is created. In such a case you cannot hard code the value during variable declaration. such kind of code can be placed inside the constructor so that the initialization would happen when the class is instantiated.Properties:1. You need not code them explicitly. Java will automatically place a default constructor2. You can pass arguments to the constructor3. They can return only an object of type of that class4. They can be made private5. They would be executed always (Everytime a class is instantiated)


What happen when you place functions in the head section of the HTML document?

You can place functions in the head section. They will be styled the same way head is styled.


What happen with my section 8 application?

Those particular forms usually get misplaced.


What happen in Beowulf section I IV?

that guy, he did that thing and then he went there. the end. happy?