0
Hello Everone,,,
Is it Compilsory to make constructors in java classes????
4 Antworten
+ 6
Programmer{■}
➝ Java automatically provides a default constructor, so all classes have a constructor, whether one is specifically defined or not.
https://www.sololearn.com/learn/Java/2157/
+ 6
When we create the object then the constructor will be automatically called
by the JVM.
If you don't define any constructor, the compiler automatically creates a default constructor and assign default values for all your variables in the class.
NOTE:
If you define at least one constructor,
the default constructor is not generated.
+ 4
If you do not create a constructor, a default constructor which does nothing will be generated by your compiler.
0
Hatsy Rei .when default constructor is generated...after that we need to call it or not??