+ 3

what is the use of default constructor in JAVA?

30th Aug 2018, 2:45 PM
Slim Jxmmi
3 Answers
+ 10
... To initialize class members when given no arguments? Is there anything in particular that you do not understand from that?
30th Aug 2018, 2:50 PM
Hatsy Rei
Hatsy Rei - avatar
+ 4
Constructor as the name implies it is useful to construct the object. As we know object is nothing but an entity which has its own states and behavior meaning that it has its own data member and function member. So, here "construct the object" in turn it means that constructing the data members of the object you create. Default constructor is something which is useful to initialize the data members (Variables) to their default value when you create any object.
30th Aug 2018, 4:10 PM
Maninder $ingh
Maninder $ingh - avatar
+ 1
it initilize the value of member variable
3rd Sep 2018, 7:16 PM
Aarav Raj
Aarav Raj - avatar