What is constructor...pls tell me shortly | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is constructor...pls tell me shortly

13th Jun 2017, 7:23 AM
sri prasanna selvam
2 Answers
0
a non static block which is implicitly invoked while object creation. constructors are mainly used to initialize fields. The first statement of constructor is a super() calling statement.If a programmer doesn't define a constructor in the program, then JVM puts a default constructor ie. no-arg constructor. constructors can be overloaded. I Hope this helps.
13th Jun 2017, 7:37 AM
Ayush
Ayush - avatar
0
thanks bro
13th Jun 2017, 7:39 AM
sri prasanna selvam