+ 1
in one class how many constructors define?
6 Answers
+ 4
you can define many constructor as you required
+ 2
There is always a default constructor.
you can create your custom constructors with the help of function overloading.
+ 1
when u create an object and if u did not create constructor then JRE make a default constructor itself....
and U create number of constructors and call with object .
+ 1
as many as u want!
+ 1
define as many as you want. Although Java provides a default constructor, good practice would dictate you always provide a constructor to initialize all attributes to a default value. This provides documentation to the code and leaves nothing to chance. Not initializing attributes can lead to errors.
0
You can define no constructor. In this case, Java provides a default constructor with no parameter when you create an object(instance) of a class.
You can define one or more than one constructor. In this case, The default constructor that Java provides will not be used. And the constructor that you created will be used when you create an object(instance) of a class.