0

What are costructors in java?

11th Jul 2016, 4:07 PM
Kumar Swapnil
Kumar Swapnil - avatar
5 odpowiedzi
+ 1
Constructors are nothing but methods which has the same name as the "SubClass", and it executes automatically without calling them. -They are executed before the creation of the "object". -We can't declare them as static. -parameter passing wise they are of 2 types. I. Zero parameter constructor 2. Parameterized constructor
12th Jul 2016, 4:52 AM
Subham Kumar Bisoyi
Subham Kumar Bisoyi - avatar
0
one time diclare only automatic run
12th Jul 2016, 5:14 AM
siddhik nizami
siddhik nizami - avatar
0
constructors are basically used to initialize there are two types of constructors 1.default 2.parameterized default constructor executes defaultly and parameterized constructor executes when parameter is passed
14th Jul 2016, 6:53 AM
Keshava Shourie
Keshava Shourie - avatar
0
constructor are used to initialise the objects when we write class_name object = new class_name () It calls the default constructor which is written by java developers only when if didn't created our own constructor when we call constructor using above statement then memory for attributes respective to class is allocated
15th Jul 2016, 6:17 PM
Apurva
0
constructors are the methods having same name as a class.it does not have any return type and is called implicitly, that is, it is called directly when we make an object in main. there are two types of constructor------ 1) parameterised 2) non - parameterized it is generally used to initialize default values of variables according to their data types.
16th Jul 2016, 5:41 PM
Harsh Vardhan