what is constructor??
yamafuji:
questions lack some information
Answers
Answered by
2
In class-based object-oriented programming, a constructor is a special type of subroutine called to create an object. It prepares the new object for use, often accepting arguments that the constructor uses to set required member variables.
hope this helps you
hope this helps you
Answered by
11
⭐️⭐️Hello Kajal.⭐️⭐️
⭐️Your Ans.⭐️
✍️✍️✍️✍️
A static constructor does not take access modifiers or have parameters. A static constructor is called automatically to initialize the class before the first instance is created or any static members are referenced. A static constructor cannot be called directly.
A special method of the class that will be automatically invoked when an instance of the class is created is called a constructor. The main use of constructors is to initialize private fields of the class while creating an instance for the class. When you have not created a constructor in the class, the compiler will automatically create a default constructor in the class. The default constructor initializes all numeric fields in the class to zero and all string and object fields to null.
⭐️Constructors can be divided into 5 types
1.Default Constructor
2.Parametrized Constructor
3.Copy Constructor
4.Static Constructor
5.Private Constructor
⭐️⭐️⭐️⭐️⭐️⭐️
I Hope It Help You.
✌️ Thanks For.✌️
Er.Kiran
⭐️Your Ans.⭐️
✍️✍️✍️✍️
A static constructor does not take access modifiers or have parameters. A static constructor is called automatically to initialize the class before the first instance is created or any static members are referenced. A static constructor cannot be called directly.
A special method of the class that will be automatically invoked when an instance of the class is created is called a constructor. The main use of constructors is to initialize private fields of the class while creating an instance for the class. When you have not created a constructor in the class, the compiler will automatically create a default constructor in the class. The default constructor initializes all numeric fields in the class to zero and all string and object fields to null.
⭐️Constructors can be divided into 5 types
1.Default Constructor
2.Parametrized Constructor
3.Copy Constructor
4.Static Constructor
5.Private Constructor
⭐️⭐️⭐️⭐️⭐️⭐️
I Hope It Help You.
✌️ Thanks For.✌️
Er.Kiran
Similar questions